Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re: Re: The problem with one-liners...

by petral (Curate)
on Feb 03, 2003 at 23:40 UTC ( [id://232413]=note: print w/replies, xml ) Need Help??


in reply to Re: The problem with one-liners...
in thread The problem with one-liners...

Oh well, a little fiddling since it's such fun stuff:
# Last line of a file perl -pe '$*=$_}{$_=$*' file
->   perl -pe '$\=$_}{' file

Which leads me to a head-tail (useful eg, for finding out the range of a log file).
perl -pe '$*||=$_; $\=$_}{$_=$*' file
and (not stopping while he's ahead) . . .
# Exit after first match perl -ne 'print; last if /foo/' file
->   perl -pe '/foo/...last' file

  p

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2024-04-19 11:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found