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
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((
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
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
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+/,)]}
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
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
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
On 14 July 2014 15:18:31 BST, John Delacour wrote:
>
>On 14 Jul 2014, at 14:11, Shlomi Fish wrote:
>
>>> perldoc -f open
>
>> This is irrelevant. Two-args open is dangerous - always use
>three-args open:
>>
>> * http://perl-begin.org/tutorials/bad-elements/#open-function-style
>
>Who wrote that?
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 form of open() is something that the general
>Perl community considers to be a
You were asked to take this off list once.
I'm now telling you, in my official capacity as list moderator:
further discussion of this is off-topic and does not belong on this
list.
Let it go.
thanks,
john.
On Mon, Jul 14, 2014 at 7:18 AM, John Delacour wrote:
>
> On 14 Jul 2014, at 14:11, Sh
On 14 Jul 2014, at 14:11, Shlomi Fish wrote:
>> perldoc -f open
> This is irrelevant. Two-args open is dangerous - always use three-args open:
>
> * http://perl-begin.org/tutorials/bad-elements/#open-function-style
Who wrote that? Ah...a certain Shlomi Fish.
open my $fh, "< $path"; # with o
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 form of open() is something that the general
Perl community considers to be a deprecated style that should not be
used with new code. This l
On Mon, 14 Jul 2014 11:13:05 +0100
John Delacour wrote:
>
> On 14 Jul 2014, at 05:39, Shlomi Fish wrote:
>
> > don't use two-args open
>
> perldoc -f open
>
> In the one- and two-argument forms of the call, the mode and
> filename should be concatenated (in that order
On 14 Jul 2014, at 05:39, Shlomi Fish wrote:
> don't use two-args open
perldoc -f open
In the one- and two-argument forms of the call, the mode and
filename should be concatenated (in that order), preferably
separated by white space. You can--but shouldn't--
Hi John,
On Mon, 14 Jul 2014 04:15:39 +0100
John Delacour wrote:
>
> On 13 Jul 2014, at 23:48, ESChamp wrote:
>
> > John Delacour has written on 7/13/2014 5:31 PM:
> >>
> >> On 13 Jul 2014, at 21:43, ESChamp wrote:
> >>
> >>> ...lastname firstname other other other ... emailaddress
> >>>
On 13 Jul 2014, at 23:48, ESChamp wrote:
> John Delacour has written on 7/13/2014 5:31 PM:
>>
>> On 13 Jul 2014, at 21:43, ESChamp wrote:
>>
>>> ...lastname firstname other other other ... emailaddress
>>>
>>> I wish to write a new file that contains only the emailaddress field
>>> contents.
Paul Johnson has written on 7/13/2014 7:22 PM:
> On Sun, Jul 13, 2014 at 06:44:18PM -0400, ESChamp wrote:
>> Paul Johnson has written on 7/13/2014 5:00 PM:
>> > perl -nale 'print $F[-1]' < original_file.txt > just_email.txt
>>
>> e:\Docs\>perl -nale 'print $F[-1]' < 4sam.txt > just_email.txt
>> Ca
On Sun, Jul 13, 2014 at 06:44:18PM -0400, ESChamp wrote:
> Paul Johnson has written on 7/13/2014 5:00 PM:
> > perl -nale 'print $F[-1]' < original_file.txt > just_email.txt
>
> e:\Docs\>perl -nale 'print $F[-1]' < 4sam.txt > just_email.txt
> Can't find string terminator "'" anywhere before EOF at
Paul Johnson has written on 7/13/2014 5:00 PM:
> perl -nale 'print $F[-1]' < original_file.txt > just_email.txt
e:\Docs\>perl -nale 'print $F[-1]' < 4sam.txt > just_email.txt
Can't find string terminator "'" anywhere before EOF at -e line 1.
???
4sam.txt is the file to be operated on. SAmple lin
On 13 Jul 2014, at 21:43, ESChamp wrote:
> ...lastname firstname other other other ... emailaddress
>
> I wish to write a new file that contains only the emailaddress field
> contents.
Here’s an easily-understood way of doing it:
#!/usr/bin/perl
use strict;
while (){
chomp;
@_ = split / /
I had this in my temp file:
abc 123 53432 t...@gmail.com
abc 123 53432 t...@gmail.com
abc 123 53432 t...@gmail.com
abc 123 53432 t...@gmail.com
abc 123 53432 t...@gmail.com
Running the following command:
perl -n -e 'm/.* ([^ ]+@.*)$/i; print $1."\n"' temp
will print:
t...@gmail.com
t...@gmail.
On Sun, Jul 13, 2014 at 04:43:41PM -0400, 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 text file consisting of several space-separated fields:
>
> lastname firstname other other other ... emailaddress
>
On Sun, 13 Jul 2014 16:43:41 -0400
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 text file consisting of several space-separated fields:
>
> lastname firstname other other other ... emailaddress
>
> I
You can try the following regexp:
.*([^ ]+@.*)$
This assumes that the email address is the last string and all strings are
space separated.
-- Fruit Vendor
On Sun, Jul 13, 2014 at 3:43 PM, ESChamp wrote:
> I apologize for having to ask this but my nearly-80-year-old brain just
> could not c
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 text file consisting of several space-separated fields:
lastname firstname other other other ... emailaddress
I wish to write a new file that contains only the emailaddress field
c
26 matches
Mail list logo