Re: Feature request
[email protected] (Bob Proulx) Sat, 22 Feb 2003 10:14:21 -0700
| Newsgroups | gmane.comp.gnu.textutils.bugs |
|---|---|
| Message-ID | <[email protected]> |
Morten Karlsen wrote:
> cut -f-1
>
> Get last field in line....
>
> Interested?
Personally I recommend using awk. Then you are not dependent upon a
particular implementation of cut and can use standard tools which are
available on all systems.
awk '{print $(NF-1)}'
echo one two three | awk '{print $1}'
one
echo one two three | awk '{print $NF}'
three
echo one two three | awk '{print $(NF-1)}'
two
Hope that helps.
Bob