[lug] Something seemingly simple
Hugh Brown
hugh at math.byu.edu
Tue Dec 19 17:45:23 MST 2006
Daniel Webb wrote:
> I want something to take a space-delimited string and return only the last
> field. The caveat: the "last field" can have any character except NULL. How
> can I extract this field from a bash variable or from a file that contains
> such an entry?
>
> Most obvious ways (bash's 'read' internal, cut, sed) all normally end
> searching for a pattern when they find a newline. I'm thinking something like
> perl's s///s construction, but I don't want a Perl dependency. Is it possible
> with the standard GNU toolkit?
>
You might also look at this
http://www-128.ibm.com/developerworks/linux/library/l-awk2.html
Hugh
More information about the LUG
mailing list