grep --files-with-matches '>' .
Search for > in the current directory (.) and print only the filenames of matching files (--files-with-matches).
Note that grep will not return anything if you give it a directory (.) but forget to enable "recursive" mode. The correct command would be
grep --files-with-matches --recursive '>' .
or simply
grep -Rl '>' .
| sort
| uniq
Sort results, and remove duplicates.
| xargs perl -pi~ -e 's/9Kp/9K /' /home/user/DATAFILE.DAT
Run the given command (perl ...) with every word1 from stdin passed as additional arguments.
Every file from the grep results, and also the /home/user/DATAFILE.DAT file, are updated by replacing the text "9Kp" with "9K ". The old files are backed up with a trailing tilde.
1 Note: word, not line. This means that a filename with spaces will be treated as several names. xargs -d'\n' would be better, although not perfect.
| sort | uniqcan be replaced by| sort -u– mouviciel Jul 29 '11 at 18:45grep --files-with-matches '>' *. – JJ01 Jul 29 '11 at 19:06