By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,246 Members | 1,221 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,246 IT Pros & Developers. It's quick & easy.

removing extra fields

100+
P: 123
Hi..
I have the below result in my one text file.


|-------------------|-
|email |
|-------------------|--
| |
| |
| |
| |
| abc@yahoo.com |
| email |
| |
| |
| |
| |
| abc@gmail.com |
| ajan@yahoo.com |
| ha@gmail.com |
| abcd@rediff.com |
| web@wemastre.com |
----------------------------------






is the table..that is in one text file..
I just want to have all the email address..

Expand|Select|Wrap|Line Numbers
  1.  
  2.  
  3.       sed -n "/com/p"  result.txt > result.csv
  4.  
and it gives me

| abc @yahoo.com|
| bbb@gmail.com|

something like this..
m missing something to avoid that extra |..
Expand|Select|Wrap|Line Numbers
  1. sed -e 's/|/ /g' result.csv > finalmail.txt
  2.  
is working for both and gives final result.I want to combine both..
Thanks
May 9 '08 #1
Share this Question
Share on Google+
1 Reply


Ganon11
Expert 2.5K+
P: 3,652
Maybe a regular expression along the lines of:

Expand|Select|Wrap|Line Numbers
  1. $line_of_text =~ /(\w+\@\w+\.\w+)/;
May 10 '08 #2

Post your reply

Sign in to post your reply or Sign up for a free account.