[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: sed awk etc..



Well, here's one on sed:

http://curt.rice.edu/sed.html

Here's one on regular expressions (a must if you plan on using sed, perl,
etc):

http://py-howto.sourceforge.net/txt/regex.txt


Here's my first sed script:

###########################################################################
# File:  unforward.sed
# Purpose:  Removes most of the annoying text added to forwarded messages.
# Author:  Koree A. Smith <koree@ameth.org>
# Last Updated:  March 27, 2002
###########################################################################

#Remove ">" which is typically added to the body of forwarded messages.
s/>//g
s/>>//g
s/>>>//g

#Remove various pieces of header info.
s/.*Received:.*//g
#Special case for the "From" header.  It is not always followed by a ":".
s/.*From.*//g
s/.*To:.*//g
s/.*Subject:.*//g
s/.*Date:.*//g
s/.*Note:.*//g

#Remove huge list of email addresses that are typical of forwarded
#messages.
#Careful with this one, it will probably remove any line that has an email
#address in it in the entire message.
s/.*@.*\.net.*//g
s/.*@.*\.com.*//g
s/.*@.*\.org.*//g
s/.*@.*\.edu.*//g
s/.*@.*\.us.*//g
s/.*@.*\.tv.*//g
#...and for the caps monster...
s/.*@.*\.NET.*//g
s/.*@.*\.COM.*//g
s/.*@.*\.ORG.*//g
s/.*@.*\.EDU.*//g
s/.*@.*\.US.*//g
s/.*@.*\.TV.*//g

#Get rid of common signatures
s/__________________________________________________.*//g
s/Do You Yahoo!.*//g
s/Make a great connection at Yahoo! Personals.//g
s/http:\/\/personals.yahoo.com//g

s/Get your FREE download of MSN Explorer at
http:\/\/explorer.msn.com\/intl.asp//g

s/Send and receive Hotmail on your mobile device:
http:\/\/mobile.msn.com//g

#Get rid of miscellaneous things added by email clients and servers
s/\[ Part.*Attached Text.*\]//g
s/\[ Part.*Included Message.*\]//g
s/.*Forwarded.*//g


Obviously, you can do more with sed than that, but it gives you an idea of
what you can do.

Koree
____________________________________
Koree A. Smith  | Ameth Technologies
koree@koree.net | koree@ameth.org
     http://www.koree.net/

"I wish I could get my head out of the sand,
'cuz I think we'd make a good team,
And you would keep my fingernails clean,
But that's just a stupid dream that I won't realize,
'cuz I can't even look in your eyes without shakin',
and I ain't fakin',
I'll bring home the turkey if you bring home the bacon."

			--Weezer, "El Scorcho"

On Wed, 15 May 2002, Casey Boone wrote:

> im looking for a good place to find printable docs on using sed awk the
> other useful commandline utils (key being printable, id rather not have to
> deal with trying to print man pages again)
>
> im having to write some bash scripts to take care of some maintenance work
>
> i found a .pdf guide to bash scripting :) but it doesnt cover anything but
> bash and bash alone really
>
>
> Casey
>
>
> -
> To unsubscribe, send email to majordomo@silug.org with
> "unsubscribe silug-discuss" in the body.
>



-
To unsubscribe, send email to majordomo@silug.org with
"unsubscribe silug-discuss" in the body.