Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re: perl -pie "???"

by Chady (Priest)
on Aug 18, 2004 at 05:52 UTC ( #383869=note: print w/replies, xml ) Need Help??


in reply to perl -pie "???"

here's my take, since you want -p and not -n

perl -pi -e '$_="" if $i++' file

Update: oops! wrote it backwards. Thanx TZapper for pointing it out.

perl -pi -e '$_="" unless $i++' file

He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

Chady | http://chady.net/

Replies are listed 'Best First'.
Re^2: perl -pie "???"
by TZapper (Acolyte) on Aug 18, 2004 at 10:53 UTC
    Chady, your one-liner deletes everything but the first line.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://383869]
help
Chatterbox?
[james28909]: politicians making jobs for themselves? that is absurd! we all know how hard those politicians have it, having to take millions from lobbiest while screwing over their citizens. have a little sympathy why dont ya!

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (9)
As of 2017-12-15 18:33 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What programming language do you hate the most?




















    Results (442 votes). Check out past polls.

    Notices?