do p4 edit for multiple files which contain a matching pattern do p4 edit for multiple files which contain a matching pattern shell shell

do p4 edit for multiple files which contain a matching pattern


Pass the output of grep to xargs

grep -rl "pattern" * | xargs p4 edit


The normal way to do this is to do:

grep -rl "pattern" * | p4 -x - edit

p4 help usage explains -x:

The -x flag instructs p4 to read the arguments, one per line, from the specified file. If you specify '-', standard input is read.


I think this information is might useful to someone. First run following command to open all files.

p4 edit ...

Make your changes and run following command to revert the files which are not modified.

p4 revert -a