Hello I´m currently trying to search for logfiles which are starting with xy_Number and are created/edited today(not last 24 hrs).
I tried:
find /home/USER/logfilesError/ -maxdepth 1 -type f -daystart -mtime -1 print0 | xargs -0 grep - l xy_*
Output:
find: paths must precede expression: print0
I need to combine:
find -maxdepth 1 -type f -daystart -mtime -1
and
ls | grep -E "xy_"
What I want to achieve is:
Search logfiles from a specific location which today's date and then go a step further and search those files and output the ones which have lines starting with ERROR. (other lines INFO and DEBUG)
So the search works fine and I want to go further with checking the files after the search with a grep to find the files containing ERROR
grep -rl "ERROR" /home/USER/logfilesError/
How do I combine those in a script? With If? Can someone help me with this?
-print0
is missing a hyphen and thus interpreted as a path name. This causes the error message.