Re: [newbie] bash script to remove >?

2001-06-06 Thread n6tadam

Hi,

This can be done, using the following:

1. assuming that your local mailbox is in "/var/spool/mail/$username", then
do the following:

snip

#!/bin/bash
regex=">"
mailbox="/var/spool/mail/$username

#list contents
cat $mailbox | grep $regex | sed -e "/$regex//g;" > /var/spool/mail/newmail

snip

2. replace all instances of $username mentioned above with the actual
filename of your inbox. If the inbox you will be searching is not your own,
then this script will have to be ran as the root user.

3. Save the above script in "/usr/bin" folder, using a suitable name, and
issue the following command:

chmod 700 /usr/bin/filename

4. Then run the script. The resultant output will appear in the file
"/var/spool/mail/newmail"

HTH,

Thomas Adam
Linux Co-ordinator for the Purbeck School (Network Support)

- Original Message -
From: Jon Doe <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Wednesday, June 06, 2001 4:55 AM
Subject: [newbie] bash script to remove >?


> I know it has to be pretty simple but I can't figure it out. How can I
right
> a bash script to remove the > from forwarded emails?
>
>


Please note that the content of this message is confidential between the original 
sender and the intended recipient(s) of the message. If you are not an intended 
recipient and/or have received this message in error, kindly disregard the content of 
the message and return it to the original sender.

If you have any complaints about this message please reply to:
   [EMAIL PROTECTED]

The Purbeck School E-Mail server running:
   users.purbeck.dorset.sch.uk





Re: [newbie] bash script to remove >?

2001-06-05 Thread Paul

It was Tue, 5 Jun 2001 23:55:02 -0400 when Jon Doe wrote:

>I know it has to be pretty simple but I can't figure it out. How can I right 
>a bash script to remove the > from forwarded emails?

You have to have the e-mail in a separate file (like the MH mail structure).
Then you can test the first character of a line and use the 'cut' command to
take it off if it is a >

See man bash for info on how to determine the first character of a line...

Paul

--
"Avoiding danger is no safer in the long run than outright 
exposure.  The fearful are caught as often as the bold."
-Helen Keller

http://nlpagan.net -  Registered Linux User 174403
   Linux Mandrake 7.2 - Sylpheed 0.4.66
** http://www.care2.com - when you care **




[newbie] bash script to remove >?

2001-06-05 Thread Jon Doe

I know it has to be pretty simple but I can't figure it out. How can I right 
a bash script to remove the > from forwarded emails?