extracting emails from a file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting extracting emails from a file
# 1  
Old 01-21-2012
extracting emails from a file

i have a large html file that has emails
like something@domain.com
and something[at]domain.com


how can i print the emails? its fine if duplicates show up and it doesnt need to save into a file or anything, just whatever is the easiest way to make some basic code for this

thanks! Smilie
# 2  
Old 01-21-2012
You mean email addresses? Try:
Code:
grep -o '[^ \t]*@[^ \t]*' file

# 3  
Old 01-22-2012
Could try this, (should pickup most valid email addresses):

Code:
sed s'/\[at\]/\@/' infile | grep -oE '\b[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}\b'

Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Making post down hook script for svn regarding sending emails after an file is committed in svn

Hi Folks , I am asking this question but i apologise please if this is not the correct forum , I have to develop a shell script that i want to place in at hooks/post-commit , that is basically i have to develop a post hook script and the main functionality of that script would be lets say if... (0 Replies)
Discussion started by: sunsun06060606
0 Replies

2. UNIX for Dummies Questions & Answers

Extracting data from one file, based on another file (splitting)

Dear All, I have two files but want to extract data from one based on another... can you please help me file 1 David Tom Ellen and file 2 David|0010|testnamez|resultsz David|0004|testnamex|resultsx Tom|0010|testnamez|resultsz Tom|0004|testnamex|resultsx Ellen|0010|testnamez|resultsz... (12 Replies)
Discussion started by: A-V
12 Replies

3. Shell Programming and Scripting

reading a file extracting information writing to a file

Hi I am trying to extract information out of a file but keep getting grep cant open errors the code is below: #bash #extract orders with blank address details # # obtain the current date # set today to the current date ccyymmdd format today=`date +%c%m%d | cut -c24-31` echo... (8 Replies)
Discussion started by: Bruble
8 Replies

4. Shell Programming and Scripting

extracting line numbers from a file and redirecting them to another file

i have applied the following command on a file named unix.txt that contains the string "linux from the text" grep -n -i -w "linux from the text" unix.txt and the result is 5:Today's Linux from the text systems are split into various branches, developed over time by AT&T as well as various... (5 Replies)
Discussion started by: arindamlive
5 Replies

5. Shell Programming and Scripting

Extracting a column from a file and merging with other file using awk

Hi All: I have following files: File 1: <header> text... text .. text .. text .. <\header> x y z ... File 2: <header> text... text .. text .. (4 Replies)
Discussion started by: mrn006
4 Replies

6. Shell Programming and Scripting

Parsing file, yaml file? Extracting specific sections

Here is a data file, which I believe is in YAML. I am trying to retrieve just the 'addon_domains" section, which doesnt seem to be as easy as I had originally thought. Any help on this would be greatly appreciated!! I have been trying to do this in awk and mostly bash scripting instead of perl... (3 Replies)
Discussion started by: Rhije
3 Replies

7. UNIX for Dummies Questions & Answers

Command file for moving emails

hey guys. I'm trying to create a command file that moves my emails to a specified folder according to a keyword that is in the subject. like move emails with "hey" in the subject to a folder that exists in my mail folder named "hey". how do I go about that? thanx. (9 Replies)
Discussion started by: ~samantha89~
9 Replies

8. Shell Programming and Scripting

Extracting data from text file based on configuration set in config file

Hi , a:) i have configuration file with pattren <Range start no>,<Range end no>,<type of records to be extracted from the data file>,<name of the file to store output> eg: myfile.confg 9899000000,9899999999,DATA,b.dat 9899000000,9899999999,SMS,a.dat b:) Stucture of my data file is... (3 Replies)
Discussion started by: suparnbector
3 Replies

9. Shell Programming and Scripting

extract bulk emails into a single flat file

Hello Can someone guide me how to extract bulk emails into a single flat file ? We receive mails (approx 1K daily ). I want the contents of the emails for 'current date' to be dumped into one single text file. Please help. (1 Reply)
Discussion started by: Amruta Pitkar
1 Replies

10. Shell Programming and Scripting

[Splitting file] Extracting group of segments from one file to others

Hi there, I need to split one huge file into separate files if the condition is fulfilled according to that the position between 97 and 98 matches with “IT” at the segment MAS. There is no delimiter file is fix-width with varous line length. Could you please help me how I do split the file... (1 Reply)
Discussion started by: ozgurgul
1 Replies
Login or Register to Ask a Question