The first command works: grep "Jan 24" /var/log/messages | less
The second command after evaluation of `date +"%b %e"` doesn't work: grep Jan 24 /var/log/messages | less The second command didn't work because there's a space in the date. The grep command is looking for 'Jan' in the files '24' and '/var/log/messages'. That's why grep said it couldn't find the file '24'. The command is missing quotes around the output of the date command. grep: 24: No such file or directory Juan Martinez On Thu, 24 Jan 2002, Nicole Kok wrote: > Date: Thu, 24 Jan 2002 14:08:39 -0500 (EST) > From: Nicole Kok <[EMAIL PROTECTED]> > Reply-To: [EMAIL PROTECTED] > To: [EMAIL PROTECTED] > Cc: [EMAIL PROTECTED] > Subject: Re: command > > Dear Rodolfo > > Thank you > > But why two commands take different results > and last one doesn't apply it? > > first one: work, start from Jan 24 > Jan 24 07:09:24 syslogd 1.4-0: restart. > Jan 24 07:09:24 syslog: syslogd startup succeeded > Jan 24 07:09:24 syslog: klogd startup succeeded > > > Second: doesn't work, start from Jan 20 > [root@ log]# grep `date +"%b %e"` /var/log/messages | > less|more > grep: 24: No such file or directory > /var/log/messages:Jan 20 08:45:32 syslogd 1.4-0: > restart. > /var/log/messages:Jan 20 08:45:32 syslogd 1.4-0: > restart. > /var/log/messages:Jan 20 08:45:32 syslogd 1.4-0: > restart. > > > > > > --- "Rodolfo J. Paiz" <[EMAIL PROTECTED]> wrote: > > At 1/24/2002 12:29 PM -0500, you wrote: > > >Which command I can start to read /var/log/messages > > >from the latest date? > > > > Simple: > > > > # grep "Jan 24" /var/log/messages | less > > > > Remember that the day-of-the-month is *always* in > > two digits. Hence for > > Feb/1 you'd use "Feb 1" (note two spaces instead of > > one). > > > > If you want to get cute: > > > > # grep `date +"%b %e"` /var/log/messages | less > > > > > > -- > > Rodolfo J. Paiz > > [EMAIL PROTECTED] > > > > > > > > _______________________________________________ > > Redhat-list mailing list > > [EMAIL PROTECTED] > > > https://listman.redhat.com/mailman/listinfo/redhat-list > > > ______________________________________________________________________ > Web-hosting solutions for home and business! http://website.yahoo.ca > > > > _______________________________________________ > Redhat-list mailing list > [EMAIL PROTECTED] > https://listman.redhat.com/mailman/listinfo/redhat-list > _______________________________________________ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list
