awk assistance

Mark Polhamus meplists at earthlink.net
Wed Nov 13 11:12:03 EST 2002


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}'


-- Mark





More information about the gnhlug-discuss mailing list