Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Reading Email Files in KSh Script

Status
Not open for further replies.

iGNiTE

Technical User
Apr 11, 2002
2
AU
Hi,

How would I make a script that reads a mail file, extracts the From: name and the Subject: line from each email, and then displays those to me in a numbered menu for me to see?

I know theres a way of doing this without awk or sed. I'm fairly new to Unix so please help! :)

Thanks,
iGNiTE
 
Arelike you are looking for an email client
other than the mail utility?
I think trying to write your own script may be
a difficult task.

Robert G. Jordan
Unix Sys Admin
Sleepy Hollow, Illinois U.S.A.

FREE Unix Scripts
 
nah, I'm not looking for an email client...
ok simple things first...how do i read a file and find words in it? for example From: and Subject:? I'd think it'd consist of a while loop to read each line right?
and maybe an if statement to find the From: and Subject: lines.

any ideas? code would be nice :)

cheers,
iGNiTE
 
egrep '^Subject:|^From:' my_mailbox_file

will do what you asked for, but I have to agree with Robert - do you mind if I ask why you need to do this instead of using one of the million or so mail clients already out there? Mike
"Experience is the comb that Nature gives us after we are bald."

Is that a haiku?
I never could get the hang
of writing those things.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top