Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

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

by petral (Curate)
on Feb 03, 2003 at 23:40 UTC ( #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
Node Status?
node history
Node Type: note [id://232413]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (5)
As of 2016-06-27 02:16 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    My preferred method of making French fries (chips) is in a ...











    Results (335 votes). Check out past polls.