Issue
Have a directory with files. how to grep all files with a particular keyword and files should be created today.
tried this :
grep -r -n "pass" *.json
this gives the line number and only searches json file but how to add pipe to search for only files that are created today
Solution
Use the find
command as the source of the list of files to search.
grep -n "pass" $(find . -daystart -ctime 0 -name '*.json')
-ctime
says "creation date should have been 0 days ago", and -daystart
says to base it on the beginning of the day for "days ago", not "24 hours ago" ago.
Answered By - Andy Lester Answer Checked By - Marie Seifert (WPSolving Admin)