extract bulk emails into a single flat file


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting extract bulk emails into a single flat file
# 1  
Old 01-15-2007
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.
# 2  
Old 01-21-2007
Email boxes are already in a flat file format.

If you want to spilt the mail into seperate files on a daily base do something like this:

Create a ".forward" file in the home directory of the account which receives the mail.

Notice the DOT in front of forward.

The ".forward" file could look like something like this:

cat .forward
---------------------------------------------
"|<some path>/splitmail.sh"
---------------------------------------------

where <some path> needs to be replaced by the actual path where the script "splitmail.sh" is located.

The ".forward" file will cause the email to be send to the script "splitmail.sh".

The "splitmail.sh" script could look like something like this:

cat splitmail.sh
---------------------------------------------
#!/usr/bin/ksh
DATE=`date +%Y%m%d`

cat - >> <some path>/mail.${DATE}
---------------------------------------------

Replace <some path> by the location where you want the files to be created.

This is just a basic example. As a result all mail will end up in files on a day base. So no mail will be present in the "normal" inbox.

It is possible to have it both, so as well in seperate files as well as still in the inbox.

See the manual pages for "forward".

There are programs/tools out there which allow you to manipulate mail in a far more complex way. One of them is "procmail".
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Oracle table extract: all columns are not converting into pipe delimited in 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... (5 Replies)
Discussion started by: express14
5 Replies

2. Shell Programming and Scripting

Extract a single file from a tar file to another directory

Hi, I need to extract a single file from a tar file to another directory. So far I have this: This one extract a single file to same directory: tar -xvf filename.tar ./file.txt I tried this but its not working tar -xvf filename.tar /home/dir ./file.txt or this: (6 Replies)
Discussion started by: erin00
6 Replies

3. UNIX for Dummies Questions & Answers

[Solved] How to extract single and duplicate lines from file?

Hi, I need help! I have two files, one containing a list of codes and the other a list of codes and their meaning. I need to extract from file 2 all the codes from file 1 into a new file. These are my files: File1: Metbo Metbo Memar Mth Metbo File2: Metbo Methanoculleus... (3 Replies)
Discussion started by: Lokaps
3 Replies

4. Shell Programming and Scripting

Merging the flat files into a single file

Hi, My requirement is search for the flat files in the location that are generated in a day and merge them into a single flat file. In the merged file as well particular column value should go into particular column. awk 'NR=1 FNR>1' $(ls -rt flatfile1_v_*) when i use this command for... (4 Replies)
Discussion started by: srikanth_sagi
4 Replies

5. Shell Programming and Scripting

Find and Extract all emails from my server

My linux version is: Linux version 2.6.9-89.0.9.ELsmp (gcc version 3.4.6 20060404 (Red Hat 3.4.6-11)) My problem is simple (lol) I need find and extract all e-mail from my server. I know how to extract the e-mail from a text file, the problem is: Where to find the e-mails? How to find all... (2 Replies)
Discussion started by: mauricio_yan
2 Replies

6. UNIX for Advanced & Expert Users

What is command to extract single file from an archieve?

I just want to extract one sigle file from an .ear archieve instead of extracting whole ear. Can anyone help me on this? (4 Replies)
Discussion started by: harshal_dcx
4 Replies

7. UNIX for Dummies Questions & Answers

tar command help -- extract single file

Hi, I want to view/display the contents of one file in tar file. For example if the tar file is sam.tar.gz and one of the file inside is E1.txt, how do i view the contents of this E1.txt file. Olso if I want to extract the E1.txt file only from sam.tar.gz how can i do that. Thanks in... (7 Replies)
Discussion started by: icefish
7 Replies

8. Shell Programming and Scripting

tar: extract single file to different filepath

Hi, This is my first post here - I'm hoping I can get some help! I have searched these forums and othersand not getting anything that works. I am trying to extract a single file from a tar archive to a diffierent location than it will default to. For example my tar log shows me ... a... (3 Replies)
Discussion started by: littleIdiot
3 Replies

9. UNIX for Advanced & Expert Users

how to unzip and extract tar file in single command

In order to save diskspace and avoid of disk full during unzip then extract the tar file is there any tar unzip command would unzip and extract tar at the same time (test123.tar.gz) thank in advance (6 Replies)
Discussion started by: darkrainbow
6 Replies

10. Programming

How to read specific lines in a bulk file using C file Programming

Please Help me I have a Bulk file containing Hex data I want to read specific lines from that bulk file by ID number. example ID DATE Time data 14 2005/09/28 07:40:08.546 0 5 078B1C 01916C 0FE59C 004B54 0A9670 0D04ED 05B6B4 0E2223... (10 Replies)
Discussion started by: rajan_ka1
10 Replies
Login or Register to Ask a Question