On Wed, 2003-10-01 at 10:20, Brett Franck wrote:
> Hi,
> 
> I am trying to view log files using GREP and variable substitution.  Let's say a 
> user wants to view a log file for "Sep 30"  Here is the shell (BASH) script that I 
> put together for it.
> 
> #!/bin/sh
> cd /routerlogs
> echo
> date
> echo
> date=`date | cut -c5-7`
> echo "Which Date Do You Wish to Parse?:"; read dte;
> echo "Searching....."
> grep -e "$date $dte"  *.log | grep -e WARNING 
> 

grep -e "$date *$dte .*WARNING" *.log should get you close

this says find a line that has whatever is in $date followed by zero or
more spaces followed by whatever is in $dte followed by a single space
followed by zero or more of any thing followed by WARNING

I think :)

Bret



-- 
redhat-list mailing list
unsubscribe mailto:[EMAIL PROTECTED]
https://www.redhat.com/mailman/listinfo/redhat-list

Reply via email to