[PLUG] Another grep question
Steven Raymond
stever at woo-hoo.com
Sun Aug 3 12:00:02 UTC 2003
Okay, now that I got "echo" to stop stripping out my wanted spaces, how do
I pass the output of it to grep, surrounded by quotes? The following is
broke because grep sees:
DATESTR=`date -d "today" '+%b %e'`
grep `echo "$DATESTR"` /var/log/maillog
grep Aug 3 /var/log/maillog
Grep doesn't like the space(s) between Aug and 3. I have tried all sorts
of single- and double-quoting around the echo command, but it gets broken
in various ways. Any easy fixes?
Perhaps I should explain my end goal instead of bugging plug every 15
minutes when I run into a new problem. I simply want to make a daily (or
perhaps every 4 hours) cron job that emails me the output of every line of
my /var/log/maillog* which contains the word "reject" so I can keep track
of spams (for alerting me to false positives). Plus I get a small thrill
just seeing how many spams are correctly rejected. There must be a
smarter way to do so than my current scripting efforts which have thus far
been a shameful embarrasment. ;) Advice is appreciated.
More information about the PLUG
mailing list