Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Skip lines until you find a delimiter >>

by RohanGuddad (Initiate)
on Mar 14, 2018 at 07:05 UTC ( [id://1210866]=perlquestion: print w/replies, xml ) Need Help??

RohanGuddad has asked for the wisdom of the Perl Monks concerning the following question:

how to Skip first few lines until you find a delimiter ">>"
  • Comment on Skip lines until you find a delimiter >>

Replies are listed 'Best First'.
Re: Skip lines until you find a delimiter >>
by tybalt89 (Monsignor) on Mar 14, 2018 at 08:02 UTC

    Guessing...

    #!/usr/bin/perl # http://perlmonks.org/?node_id=1210866 use strict; use warnings; $/ = '>>'; <DATA>; $/ = '"'; chomp( my $variable = <DATA> ); print "variable = '$variable'\n"; __DATA__ <"Session Date:Mar 13/2017 ":>>test", 1,2,3,4 ":>>test1", 5,6,7,8 end>

    Outputs:

    variable = 'test'
      so this will skip first few lines and read from ">>"?

        Did on read the post or try the code provided?

    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: Skip lines until you find a delimiter >>
by Anonymous Monk on Mar 14, 2018 at 07:24 UTC

    Please show us what you've tried and give a sample of your data

      i have file with some data like below. <"Session Date:Mar 13/2017 ":>>test", 1,2,3,4 ":>>test1", 5,6,7,8 end> i want to skip first few lines until i encounter line with ":>>" and load the first value (test) to a variable..

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://1210866]
Approved by marto
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chilling in the Monastery: (2)
As of 2024-04-24 23:36 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found