LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   grep help (https://www.linuxquestions.org/questions/programming-9/grep-help-606495/)

akhil.mud 12-13-2007 05:55 AM

grep help
 
i have given a command
da=`date|cut -d" " -f2,3`

which gives output like
Dec 13
now i want to use this in grep command like
ls -ltr / |grep $da
but it has given me error that grep 13 no such file or directory

can someone help in this,is there any switch which can be used with
grep

radoulov 12-13-2007 06:01 AM

Code:

da="$(date +"%b %d")"
ls -ltr /|grep -F "$da"

or:

Code:

ls -ltr /|grep -F "$(date +"%b %d")"

ghostdog74 12-13-2007 06:11 AM

GNU awk
Code:

ls -l| awk '$6" "$7 == strftime("%b %d")'

akhil.mud 12-13-2007 06:23 AM

thanks!!!!! it solved my problem


All times are GMT -5. The time now is 01:32 AM.