awk assistance
Tom Buskey
tom at buskey.name
Wed Nov 13 12:25:22 EST 2002
"Scott Prive" said:
>Be aware this catches all last fields... *including* directories. Use `find -t
>ype f` if you want to pre-filter anything that isn't a file.
>
>Most UNIX literature gives awk very little coverage (a pity). The awk User Gui
>de is helpful:
>http://www.gnu.org/manual/gawk-3.1.1/gawk.html
I'd also recomment the Awk Programming book by the authors of awk: Aho,
Weinberger, and Kernihan (AWK). Classic Kernihan style.
>
>
>> -----Original Message-----
>> From: Price, Erik [mailto:eprice at ptc.com]
>> Sent: Wednesday, November 13, 2002 11:19 AM
>> To: Mark Polhamus
>> Cc: gnhlug-discuss at gnhlug.org
>> Subject: RE: awk assistance
>>
>>
>>
>>
>> > -----Original Message-----
>> > From: Mark Polhamus [mailto:meplists at earthlink.net]
>> > Sent: Wednesday, November 13, 2002 11:12 AM
>> > To: Price, Erik
>> > Cc: gnhlug-discuss at gnhlug.org
>> > Subject: Re: awk assistance
>> >
>> >
>> > Price, Erik wrote:
>> > > ...
>> > > If not, the other alternative I was thinking of was the awk
>> > > equivalent of
>> > >
>> > > 1. set the field separator to a slash
>> > > 2. awk the file for the last field.
>> > >
>> > > I've figured out how to set the field separator (from the
>> man page)
>> > > but it seems I need to use a numeric variable to represent the
>> > > field I want to print. I don't know of a way to get the
>> last field
>> > > for any given record/line since one one line it could be
>> $5 and on
>> > > another it might be $7, for example.
>> >
>> > awk -F/ '{print $NF}'
>>
>>
>> Works perfect.
>>
>>
>> Erik
>> _______________________________________________
>> gnhlug-discuss mailing list
>> gnhlug-discuss at mail.gnhlug.org
>> http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss
>>
>>
>_______________________________________________
>gnhlug-discuss mailing list
>gnhlug-discuss at mail.gnhlug.org
>http://mail.gnhlug.org/mailman/listinfo/gnhlug-discuss
>
--
-------
Tom Buskey
More information about the gnhlug-discuss
mailing list