Extracting email addresses from a flat file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Extracting email addresses from a flat file
# 1  
Old 10-11-2010
Java Extracting email addresses from a flat file

All,

I have a flat file which contains an email address in every line. I am trying to find a way to extract all the email addresses delimited by comma (,). Can you please show me a way, it will be very helpful, thanks.
# 2  
Old 10-11-2010
Perhaps using paste

Code:
paste -sd, file_with_email_addresses

# 3  
Old 10-11-2010
you need provide us the sample file first.
# 4  
Old 10-11-2010
Should work:
Code:
awk -F'[ ,;]' '{for(i=0;++i<=NF;){if($i~/@/)x=(x)?x","$i:$i}}END{print x}' file

if not please provide a data sample

Quote:
Originally Posted by sed_beginner19
I have a flat file which contains an email address in every line.
Smilie
Code:
awk -F'[ ,;]' '{for(i=0;++i<=NF;){if($i~/@/)$0=$i}}1' ORS="," file

Login or Register to Ask a Question

Previous Thread | Next Thread

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

URGENT HELP!!! Extracting db table into flat file

Hi All, I am writing a shell script to extract oracle table into a pipe dilemited flat file. Below is my code and I have attached two files that I have abled to generate so far. 1. Table.txt ==> database extract file 2. flat.txt ==> pipe delimited after some manipulation of the original db... (0 Replies)
Discussion started by: express14
0 Replies

2. Shell Programming and Scripting

Extracting data into flat file thru unix

Hi, I need to extract a oracle staging table to a flat file thru unix batch process.We are expecting more than 4million records in the table.I know I can do it using "UTL_FILE" .But,since "UTL_FILE" takes a lot of time I am looking for better options.Can any body suggest some better options? ... (3 Replies)
Discussion started by: Beena
3 Replies

3. Shell Programming and Scripting

Create email Addresses

Hi, I own 2 websites 1world1game.com and thetoonarmy.net. I can access my 1world accont using mediatemples webmail. The problem i am having is that I want to allow users to register an email from a form on 1World1Game such as tom@thetoonarmy.net and be able to access it from 1world1game. ... (2 Replies)
Discussion started by: rmail2006
2 Replies

4. Shell Programming and Scripting

Shell script to email based on flat file output

Hi All, I am a newbee in unix but still have written a shell script which should trigger a mail based on certain conditions but the problem is that my file is not being read. Below is the code please advise. I do not know where is it failing. Note $ and the no followed with it is the no of... (1 Reply)
Discussion started by: apoorva
1 Replies

5. Shell Programming and Scripting

Email Question - two email addresses

Hello, I have an email script that runs when a process is complete. I would like to have the email sent to two different email addresses, but it is only sending it to the first one. Can you take a look and see what I need to correct? I thought if I surrounded them with double quotes and... (5 Replies)
Discussion started by: jyoung
5 Replies

6. UNIX and Linux Applications

email addresses

Greetings to all. I have installed dadamail on my web site and it works extremely well. I have two questions: 1. I have modified dada to bounce bad emails, but only the first newsletter will use the modifications. If I create another list, it doesn't use the modification. What gives? 2. Are... (0 Replies)
Discussion started by: okbrowder
0 Replies

7. Shell Programming and Scripting

urgent-extracting block data from flat file using shell script

Hi, I want to extract block of data from flat file. the data will be like this start of log One two three end of log i want all data between start of log to end of log i.e One two three to be copied to another file. This particular block may appear multiple times in same file. I... (4 Replies)
Discussion started by: shirish_cd
4 Replies

8. UNIX for Dummies Questions & Answers

Help extracting MAC addresses from List

Hello all. I have a large number of text files outputted from various Netstumbler Wireless Scans; from which I need to extract the MAC addresses of the various Access Points. The Text files look like this: # $Creator: Network Stumbler Version 0.4.0 # $Format: wi-scan summary with... (9 Replies)
Discussion started by: dhs23
9 Replies

9. UNIX for Dummies Questions & Answers

How to delete old email addresses?

Help! Need to delete old email addresses from address book on Dell Windows 98............. -------- The subject line was one long string - I inserted spaces - oombera (1 Reply)
Discussion started by: Deede
1 Replies
Login or Register to Ask a Question