Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re^2: search for blank lines by RegEx

by Aragorn (Curate)
on Sep 07, 2004 at 09:02 UTC ( #388970=note: print w/replies, xml ) Need Help??


in reply to Re: search for blank lines by RegEx
in thread search for blank lines by RegEx

For processing a huge file, this is a lot more (memory-) efficient than trying to load the complete file into memory. So I don't think this is a bad way to do it.

Arjen

Replies are listed 'Best First'.
Re^3: search for blank lines by RegEx [!]
by Anonymous Monk on Sep 07, 2004 at 10:47 UTC
    The question asked for a regex solution. If you want to deviate and use a loop, there's no need to use a couple of regexes inside the loop. Something like (untested):
    perl -lne 'die "Line ", $.-2, "\n" if ($e = length() ? 0 : $e+1) == 2'

      Fair point about being faithful to the question -- and thanks for the alternate approach (above my head at the moment, but I'll crack out the documentation to find out...), but I do remember reading somewhere or other about asking questions in ways that don't prejudice the answers.

      Still, this was an interesting question for the level of experience I have in Perl.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://388970]
help
Chatterbox?
[erix]: another blues with Big Red :)
[stonecolddevin]: I will say John Mayer is an excellent guitarist, I don't like his music but he's pretty damn good
[erix]: scd: maybe you like John Mayall better :)
[erix]: (mayall = british blues)
[planetscape]: sleep well, Corion
[stonecolddevin]: erix seems pretty good, i listened to "So Many Roads" and it was nice. Not everyone's cup of tea but this guy can absolutely shred, he and the guy from Mastodon are definitely up there: https://www. youtube.com/watch? v=VzhMkSN9dQc

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (11)
As of 2017-06-22 21:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How many monitors do you use while coding?















    Results (531 votes). Check out past polls.