Apologetic request for simple one-off script

2014-07-13 Thread ESChamp
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

Re: Apologetic request for simple one-off script

2014-07-13 Thread Tushar N K Jain
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 esch...@gmail.com wrote: I apologize for having to ask this but my nearly-80-year-old brain

Re: Apologetic request for simple one-off script

2014-07-13 Thread David Precious
On Sun, 13 Jul 2014 16:43:41 -0400 ESChamp esch...@gmail.com 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 ...

Re: Apologetic request for simple one-off script

2014-07-13 Thread Paul Johnson
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 I

Re: Apologetic request for simple one-off script

2014-07-13 Thread Tushar N K Jain
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

Re: Apologetic request for simple one-off script

2014-07-13 Thread John Delacour
On 13 Jul 2014, at 21:43, ESChamp esch...@gmail.com 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 (DATA){

Re: Apologetic request for simple one-off script

2014-07-13 Thread ESChamp
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 line:

Re: Apologetic request for simple one-off script

2014-07-13 Thread Paul Johnson
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 -e line 1.

Re: Apologetic request for simple one-off script

2014-07-13 Thread ESChamp
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 Can't find string

Re: Apologetic request for simple one-off script

2014-07-13 Thread John Delacour
On 13 Jul 2014, at 23:48, ESChamp esch...@gmail.com wrote: John Delacour has written on 7/13/2014 5:31 PM: On 13 Jul 2014, at 21:43, ESChamp esch...@gmail.com wrote: ...lastname firstname other other other ... emailaddress I wish to write a new file that contains only the emailaddress

Re: Apologetic request for simple one-off script

2014-07-13 Thread Shlomi Fish
Hi John, On Mon, 14 Jul 2014 04:15:39 +0100 John Delacour johndelac...@gmail.com wrote: On 13 Jul 2014, at 23:48, ESChamp esch...@gmail.com wrote: John Delacour has written on 7/13/2014 5:31 PM: On 13 Jul 2014, at 21:43, ESChamp esch...@gmail.com wrote: ...lastname firstname