[PLUG] Another grep question

Kyle Accardi sandbox at pacifier.com
Sun Aug 3 12:52:02 UTC 2003


Steven Raymond wrote:
> 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


You don't need echo here,

grep "$DATESTR" /var/log/maillog


regexps are not one of my strengths, but there's a way to tell grep to find 
"$DATESTR and "reject" so you get only the lines you care about.

--
Kyle Accardi





More information about the PLUG mailing list