Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
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


Comment on Re: Re: The problem with one-liners...
Select or Download Code

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 scrutinizing the Monastery: (10)
As of 2014-07-24 07:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (158 votes), past polls