How to copy mail content in a file in Unix


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to copy mail content in a file in Unix
# 1  
Old 09-23-2011
How to copy mail content in a file in Unix

Hi Guys
I want to write a script which search mail with subject line and after that I want the mail content in a file
please help guys.

Thanks
Atul Singh
# 2  
Old 09-23-2011
Can you display a sample of the data?
# 3  
Old 09-23-2011
The correct way to post here is:
You should start first by writing your script then once stuck or facing issues, submit your code for us to help you get it to work, stop expecting others to do your work....
# 4  
Old 09-23-2011
Hi
I want to use mail subcommands in one line..
example :

Code:
$ mail
Mail version 8.1 6/6/93.  Type ? for help.
"/var/spool/mail/training": 19 messages 19 unread
>U  1 MAILER-DAEMON@localh  Wed Jul 20 17:28 116/3450  "Returned mail: This is the mail"
 U  2 MAILER-DAEMON@localh  Thu Jul 21 10:19  65/2545  "Returned mail: details"
 U  3 MAILER-DAEMON@localh  Mon Aug 29 15:44  68/2742  "Returned mail: see "
 U  4 MAILER-DAEMON@localh  Tue Aug 30 15:13  68/2762  "Returned mail: transcript"

I want to open mail which have this subject line "Returned mail: transcript" and want to copy the mail content in a file.
I tried with the mail commands but not able to..
please help

Last edited by Scott; 09-24-2011 at 05:39 AM.. Reason: Please use code tags...
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. UNIX for Beginners Questions & Answers

Copy the content from txt file and create a html file

I have a txt file with a list of error messages in a xml tag format, and each error message is separated with a identifier(endresult).Need to split that and copy and create a new html file.Error message has some special character. how to escape the special character and insert my data into the... (7 Replies)
Discussion started by: DevAakash
7 Replies

2. UNIX for Beginners Questions & Answers

Send file content in mail

Hi . I am new to scripting.I am trying to mail the recent file contents but not the below script which i wrote is not working.Please guide me in finishing the script File='find /Directory path/*.fnr | tail -1' content=' cat $File' echo $content | mail -s "Subject " "myname@company.com" ... (7 Replies)
Discussion started by: karthik771
7 Replies

3. Shell Programming and Scripting

Shell script to monitor new file in a directory and mail the file content

Hi I am looking for a help in designing a bash script on linux which can do below:- 1) Look in a specific directory for any new files 2) Mail the content of the new file Appreciate any help Regards Neha (5 Replies)
Discussion started by: neha0785
5 Replies

4. UNIX Desktop Questions & Answers

copy content of file to another

I have a file called part1.pdb...contents are: ATOM 1 N SER 1 -10.295 -8.909 10.913 1.00 0.00 ATOM 2 H1 SER 1 -10.230 -8.214 10.183 1.00 0.00 ATOM 3 H2 SER 1 -9.558 -8.745 11.584 1.00 0.00 ATOM 4 H3 SER 1 -11.255 ... (1 Reply)
Discussion started by: kanikasharma
1 Replies

5. Shell Programming and Scripting

copy content of file to another files from certain position

Hello Guys I have a directory of xml files (almost 500 ) Now in each xml file 3 new attributes will be added which are in a different single file Is there any way I can copy the whole content of single file at 6th line of all the files in the directory . Thanks a lot!!! (7 Replies)
Discussion started by: Pratik4891
7 Replies

6. UNIX for Dummies Questions & Answers

prevent copy , forward of mail sent through unix

Hi, We are using mailx -s command to send mails from unix. We need to ensure that this mail is not copied,forwarded etc. Is there a command which can be used to achieve this using unix? Thanks. (1 Reply)
Discussion started by: dwarkeshr
1 Replies

7. UNIX for Advanced & Expert Users

prevent copy , forward of mail sent through unix

Hi, We are using mailx -s command to send mails from unix. We need to ensure that this mail is not copied,forwarded etc. Is there a command which can be used to achieve this using unix? Thanks. No double posting please, continue here. (0 Replies)
Discussion started by: dwarkeshr
0 Replies

8. UNIX for Dummies Questions & Answers

How to copy entire file content into another file being in last line mode of vi ?

How to copy entire file content into another file being in last line mode of vi ? ---------- Post updated at 10:07 AM ---------- Previous update was at 09:56 AM ---------- Got it : :1,30w file.txt (1 Reply)
Discussion started by: presul
1 Replies

9. Shell Programming and Scripting

How to copy Content of a file to another file on a specific column

Hi i have a file (file1)with this content: 1.2.3.10.in-addr.arpa and a second file (file2) with a content wich have 8 Columns if a do a awk '{print $8}' file2 i become this output: ,'10.3.2.1.', So i want to replace only the 10.3.2.1. in file2 (column 8) with the information... (8 Replies)
Discussion started by: tuxus
8 Replies

10. UNIX for Advanced & Expert Users

Reading a file and sending mail based on content of the file

Hi Gurus, I am having an requirement. i have to read a list file which contains file names and send mail to different users based on the files in the list file. eg. if file a.txt exists then send a mail to a@a.com simillary for b.txt,c.txt etc. Thanks for your help, Nimu (6 Replies)
Discussion started by: nimu1979
6 Replies
Login or Register to Ask a Question