Skip to main content
2 events
when toggle format what by license comment
Feb 7, 2019 at 10:45 comment added icarus Whilst the idea is good, the implementation is bad. I suggest find /path/to/dir -type f -maxdepth 1 -exec grep pattern /dev/null {} + - the maxdepth will limit it to the current directory. The change from \; to + will make find run grep for a batch of files, rather than running one grep for each one. Adding the /dev/null removes the very small chance of a run with a single file, which causes grep to change the output format. See unix.stackexchange.com/questions/275637/… if you lack maxdepth.
Feb 7, 2019 at 8:47 history answered George Ivanov CC BY-SA 4.0