[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: Viewing Text Output
- From: Bret Hughes <bhughes elevating com>
- To: redhat-list redhat com
- Subject: Re: Viewing Text Output
- Date: Wed Oct 1 15:58:24 2003
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
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]