Issue
I'm trying to write script or command that will go through all files in the current catalog and print only those file names that NOT contain lines starting with specific string only in the first line.
Tried this grep -i "echo" *
command to fetch all occurrences of the "echo" string but how add to it checking this first line and returning only file names?
Solution
Using GNU grep:
grep -LD skip -d skip -i '^echo' *
-L
lists non matching files, -D skip
skips device, FIFO and socket files, -d skip
skips directories.
Answered By - dan Answer Checked By - Senaida (WPSolving Volunteer)