Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Wish to keep only those lines which start with letter s, and delete all other lines.

by wog (Curate)
on Dec 06, 2001 at 04:27 UTC ( #129819=note: print w/replies, xml ) Need Help??


in reply to Wish to keep only those lines which start with letter s, and delete all other lines.

Golfing a bit:

perl -i -ne'/^s/i..print' # or if we don't care about capital s... perl -i -ne'/^s/..print'

update: s/-ine/-i -ne/g # stupid mistake

  • Comment on Re: Wish to keep only those lines which start with letter s, and delete all other lines.
  • Select or Download Code

Replies are listed 'Best First'.
Re: Re: Wish to keep only those lines which start with letter s, and delete all other lines.
by blakem (Monsignor) on Dec 06, 2001 at 06:01 UTC
    Did someone say golf? ;-)
    perl -i -pe'$_ x=/^s/i'

    -Blake

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2022-11-26 11:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Notices?