I have few files inside a folder. But some of the files contain a particular pattern inside them. I want to grep those files and do p4 edit on those files.
I have used this command on my terminal, but it doesnt work.
grep -rl "pattern" * | p4 edit
Note: I am inside the folder in which all the files reside.
Thanks
p4 change brings up a form for editing or viewing in the editor defined by the environment variable P4EDITOR . When no arguments are provided, this command creates a numbered changelist. All files open in the default changelist are moved to the numbered changelist.
The p4 fstat command dumps information about each file, with information for each field on a separate line. The output is best used within a Helix C/C++ API application where the items can be accessed as variables, but is also suitable for parsing by scripts.
p4 sync brings the client workspace into sync with the depot by copying files matching its file pattern arguments from the depot to the client workspace. When no file patterns are specified on the command line, p4 sync copies a particular depot file if it meets all three criteria: Visible through the client view.
Pass the output of grep to xargs
grep -rl "pattern" * | xargs p4 edit
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With