At 1/24/2002 02:08 PM -0500, you wrote: >But why two commands take different results >and last one doesn't apply it?
Because I made a mistake. :) The second should be: # grep "`date +'%b %e'`" /var/log/messages | less >Second: doesn't work, start from Jan 20 >[root@ log]# grep `date +"%b %e"` /var/log/messages | >less|more The mistake is that the `date` stuff in between the backticks is replaced *only* by the result of the command. So that command becomes: (wrong) # grep Jan 24 /var/log/messages | less grep is only expecting one argument, so it uses "Jan" as the search string and then thinks "24" and "/var/log/messages" are the files to search. No file named "24" exists, so it issues an error and then goes on to the second file. All the lines in the second file contain the string "Jan" so the entire file is given to you. I used double quotes on the outside and single quotes on the inside so that the shell wouldn't be confused about which quote is paired with which other. Note that "less" does the same thing as "more", so you don't need to use both. Pick one of the two; less does a little extra, but more is easier to learn for newbies. The reason I gave you the second command is because you might want to put it into a short script, and it will work every day without you typing anything specific. -- Rodolfo J. Paiz [EMAIL PROTECTED] _______________________________________________ Redhat-list mailing list [EMAIL PROTECTED] https://listman.redhat.com/mailman/listinfo/redhat-list