On 07/17/2014 09:02 AM, Lars Noodén wrote:
On 07/17/2014 03:30 PM, Michael Lynch wrote:
how about using awk to print the last column, using number of columns
variable $NF:

awk '{print $NF}' file


Regards,
Mike

Or maybe something like this in perl itself?

  perl -ne 'print @{[split(/\s+/,)]}[-1],qq(\n);' file

much earlier in this thread there were one liner examples of perl using the -a (autosplit option) which is much closer to the awk version.

also you don't need the @{[]} stuff in that code. a simple slice will do but you may need more parens to group things correctly.

thanx,

uri


--
Uri Guttman - The Perl Hunter
The Best Perl Jobs, The Best Perl Hackers
http://PerlHunter.com

--
To unsubscribe, e-mail: beginners-unsubscr...@perl.org
For additional commands, e-mail: beginners-h...@perl.org
http://learn.perl.org/


Reply via email to