Re: Apologetic request for simple one-off script

2014-07-17 Thread ESChamp
Michael Lynch has written on 7/17/2014 8:30 AM: > how about using awk to print the last column, using number of columns > variable $NF: > > |awk '{print $NF}' file| Great idea! In Windows, I used gawk "{print $NF}" file Thanks. -- To unsubscribe, e-mail: beginners-unsubscr...@perl.org

Re: Apologetic request for simple one-off script

2014-07-17 Thread Ron Bergin
Shawn H Corey wrote: > On Thu, 17 Jul 2014 17:36:28 +0300 > Lars Noodén wrote: > >> David's example with the autosplit seems much better but if a slice >> were done instead, what would be the more elegant (least inelegant?) >> way of doing it? > > I wouldn't use a slice at all: > > perl -nE'say((

Re: Apologetic request for simple one-off script

2014-07-17 Thread Shawn H Corey
On Thu, 17 Jul 2014 17:36:28 +0300 Lars Noodén wrote: > David's example with the autosplit seems much better but if a slice > were done instead, what would be the more elegant (least inelegant?) > way of doing it? I wouldn't use a slice at all: perl -nE'say((split/\s+/)[-1])' file -- Don't s

Re: Apologetic request for simple one-off script

2014-07-17 Thread Lars Noodén
On 07/17/2014 05:16 PM, Uri Guttman wrote: > On 07/17/2014 09:02 AM, Lars Noodén wrote: >> 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 optio

Re: Apologetic request for simple one-off script

2014-07-17 Thread Uri Guttman
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+/,)]}

Re: Apologetic request for simple one-off script

2014-07-17 Thread Lars Noodén
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 Regards, /La

Re: Apologetic request for simple one-off script

2014-07-17 Thread Michael Lynch
how about using awk to print the last column, using number of columns variable $NF: awk '{print $NF}' file Regards, Mike On Sun, Jul 13, 2014 at 4:43 PM, ESChamp wrote: > I apologize for having to ask this but my nearly-80-year-old brain just > could not come up with a solution. > > I have a

Re: Apologetic request for simple one-off script

2014-07-17 Thread Shlomi Fish
Hi all, On Mon, 14 Jul 2014 16:20:37 +0100 Rob Dixon wrote: > On 14 July 2014 14:22:55 BST, John SJ Anderson wrote: > >Hi. List Mom here. > > > >Please take this off list, it's not on-topic. > > > >John: Thank you for answering the OP's question. However, Shlomi is > >right, the two argument fo