On Dec 3, 2007 5:54 PM, Zach <<a href="mailto:netrek@gmail.com">netrek@gmail.com</a>> wrote:<br><div class="gmail_quote"><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi,<br><br>I have a bash script I use to parse out email addresses from log<br>files, it doesn't work 100% but is good enough to seperate out most of<br>the wheat from the chaf! The problem is it is hardcoded to use one
<br>filename at a time so I must keep editing the file, changing the<br>filename, saving script, running it, etc. Anyone know how I can make<br>this script work on any logfile so I can do: email-script.sh foo<br><br>email-script.sh
:<br><br>grep @ /tmp/trekmsglog | grep -v @$ | grep -v \( | grep -vi bomb |<br>grep -v \! | grep -v ++ | grep -v crippled | grep -v "has no gas" | grep -v 4.4.<br>0.4 | grep -vi "clue game" | grep -v " @$" | grep -v Pick | grep -v Carrying | m
<br>ore<font color="#888888"></font></blockquote><div><br>Replace the file name with $1, which means the first argument, or $* to mean all of the arguments (that way the grep runs over more than one file, if provided).<br>
<br>You could save a lot of time and processes by using egrep, and all the 'grep -v' into one expression, delimited by '|', i.e.<br><br>egrep -v '@$|bomb|\!|\+\+|crippled' (etc)<br><br></div></div>
-- <br>W. Banguna <<a href="mailto:wbanguna@GMail.COM">wbanguna@GMail.COM</a>>