Beefy Boxes and Bandwidth Generously Provided by pair Networks
There's more than one way to do things
 
PerlMonks  

Re: What one-liners do people actually use?

by crashtest (Curate)
on Dec 08, 2005 at 21:31 UTC ( #515389=note: print w/replies, xml ) Need Help??


in reply to What one-liners do people actually use?

I often find myself making use of the autosplit functionality on Windows (and even on UNIX, because I don't know much about awk).

Just last month, a cow-worker asked me for a Perl script to extract and print three specific columns from a 33-column .csv file.

perl -F, -ane "print join(',' => @F[0,8,9]), qq[\n] if (@F == 33)" inp +ut.txt

My favorite perldoc has got to be perlrun.

Replies are listed 'Best First'.
Re^2: What one-liners do people actually use?
by Perl Mouse (Chaplain) on Dec 08, 2005 at 22:52 UTC
    I would have written that as:
    perl -F, -alne '$, = ","; @F == 33 and print @F[0,8,9]' input.txt
    Perl --((8:>*

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://515389]
help
Chatterbox?
[shmem]: thanks vrk - but I'll rather have a plate of "silly con charme"
Lady_Aleena is trying to explain perl regexen to people right now and explaining how variables expand in regexen.
[Lady_Aleena]: The people I'm talking with think /$var/ looks weird with some saying it shouldn't work.

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2017-04-28 09:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I'm a fool:











    Results (520 votes). Check out past polls.