[Novalug] Perl "one-liners" (was "Tutorials")

James Ewing Cottrell 3rd JECottrell3 at Comcast.NET
Sat Dec 16 16:57:41 EST 2006


Great, but you are invoking two extra processes, one of which turns my 
stomach: cut

Cut was one of those tools released by the morons that brought you 
Systems III and V. Cut has a particularly glaring error in that it 
doesn't split on arbitrary whitespace, requiring you to resort to the tr 
dodge, which should include tabs as well.

Your thoughts are in the right place tho.

JIM

Karri Balk wrote:

>>They don't have to be one-liners. My point was that any time you are 
>>tempted to reach for awk, reach for Perl instead.
>>    
>>
>
>Why not keep it really simple and go back to the basics - tr, cut, sort:
>
>    ps -ef | tr -s ' ' | cut -d ' ' -f2
>
>It's less overhead for these sort of simple tasks.  
>
>While Unix and Perl both share the concept of providing a simple set of 
>tools that allow you to build bigger and better ones, the shell wins this 
>one.  
>
>Karri
>_______________________________________________
>Novalug mailing list
>Novalug at calypso.tux.org
>http://calypso.tux.org/cgi-bin/mailman/listinfo/novalug
>
>
>  
>




More information about the Novalug mailing list