quick awk/cut question

From: Barry Deevey (Barry.Deevey@SEFAS.CO.UK)
Date: Thu Jul 25 2002 - 04:33:37 EDT


Hi everybody,

I'm trying to extract the last field from a file that has a varied number of
fields. I'm trying

awk '{FS = "/" ; print $NF }' file.txt

But the above returns the whole of the first line, and then the last field
from the remaining lines. I know I'm doing something daft, but I just can't
see what. Also, I would have prefered to use the cut command, but with the
input file having a varied number of fields I couldn't get it to work.

Thanks in advance for any help provided, its much appreciated.

Best Regards

Barry



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:05 EDT