Re: HELP: w/ grep on a log file.
Dave,
Try grep "`date \"+ %a %b %d\" | sed 's/ //'`" arch.log
Steve Mayer
smayer@rtd.com
dave oswald wrote:
>
> Hello all...
> Thanks in advance for looking at this - please reply to
> preta@worldnet.att.net
>
> I have a log file that I need to extract some data from...
> the lines I am looking for; are the lines that contain the output from
> the command:
>
> date "+ %a %b %d" | sed 's/ //'
> or
> "Fri Jun 12"
>
> I am using sed to strip away a leading blank space that I am getting
> from the date "+ %a %b %d" .
>
> So i have this log see... and I would like to do something like a
>
> grep echo \"`date "+ %a %b %d" | sed 's/ //'`\" arch.log
>
> grabbing only the entries from the log file that have the current date
> in front of them.
>
> BUT what I get is:
> grep: can't open "Fri
> grep: can't open Jun
> grep: can't open 12"
>
> can someone please advise me on where I went wrong.
>
> below is a sample of the log file I am working against. (arch.log)
>
> Sun Jun 7 01:30:01 Beginning XTMS Archive
> Sun Jun 7 01:51:08 Archived 683 tickets
> Mon Jun 8 01:30:02 Beginning XTMS Archive
> Mon Jun 8 01:51:17 Archived 712 tickets
> Tue Jun 9 01:30:01 Beginning XTMS Archive
> Tue Jun 9 01:51:43 Archived 719 tickets
> Wed Jun 10 01:30:02 Beginning XTMS Archive
> Wed Jun 10 01:45:40 Archived 544 tickets
> Thu Jun 11 01:30:02 Beginning XTMS Archive
> Thu Jun 11 01:33:01 Archived 110 tickets
> Fri Jun 12 01:30:02 Beginning XTMS Archive
> Fri Jun 12 01:32:09 Archived 86 tickets
>
> Thanks again - preta@worldnet.att.net
>
> --
> To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
> with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
--
To UNSUBSCRIBE, email to debian-user-request@lists.debian.org
with a subject of "unsubscribe". Trouble? Contact listmaster@lists.debian.org
Reply to: