Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 examining the Monastery: (15)
As of 2015-07-06 20:29 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (83 votes), past polls