Eric J. Roode on Fri, 15 Aug 2003 21:49:38 -0400


[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: "How did I live without this?"


On Thu, Aug 14, 2003 at 02:15:59PM -0400, Chip Salzenberg wrote:
> I like it.  Strangely enough, I already have a /usr/local/bin/f:
> 
> ================================================================
> #!/usr/bin/perl -lan
> BEGIN {
>     @n = @ARGV ? (split /,/, shift) : -1;
>     for (@n) { $_-- if $_ > 0 }
> }
> @f = grep { defined } @F[@n];
> print "@f" if @f;
> ================================================================
> 
> Two diffs in function.  It supports multiple fields:
> 
>    f 1,3,5 /some/file
> 
> And it defaults to the last column, which is what you really want
> amazingly often.

I agree with MJD; this is an indispensible utility.

My version is called 'word', and it is similar in function to Chip's,
in that it does multiple fields similarly, although Chip's is slightly
simpler than my implementation.

[Pause while Eric checks ~/bin.]  I wrote mine in May of 2000.  :-)

-- 
Eric J. Roode                                            sdn@comcast.net
$_ = reverse sort $/.r , qw p ekca ts lre reh
uJ p, map $_ . $" , qw e p h tona e and print

Attachment: pgppDcqWSKW0a.pgp
Description: PGP signature