Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Matching Multiple Lines (Re: A Clarification)

by Kanji (Parson)
on Jan 02, 2003 at 23:45 UTC ( [id://223902]=note: print w/replies, xml ) Need Help??


in reply to A Clarification
in thread Matching Multiple Lines

perl -0777 -pi.bak -e 's/^0(.*\n){1,8}//mg' file

Sure it's a lot more compact, but it suffers the same problem as my non-regex solution, is going to suck majorly for large files, and is (IMHO) less obvious about what it's actually doing, especially to those unfamiliar with Perl (YMMV).

    --k.

Update: Oops, meant -0777 not -00.


Replies are listed 'Best First'.
Re: Re: Matching Multiple Lines (Re: A Clarification)
by Wally Hartshorn (Hermit) on Jan 03, 2003 at 15:16 UTC

    Very good, Kanji! That does exactly what I want! Speed isn't really an issue, and it's a one-time task. The file is several thousand lines long, and doing it by hand just didn't appeal. :-)

    This will be a great help. Thanks!

    Wally Hartshorn

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others scrutinizing the Monastery: (5)
As of 2024-04-16 05:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found