Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

do p4 edit for multiple files which contain a matching pattern

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

like image 868
biren.K Avatar asked Nov 19 '14 08:11

biren.K


People also ask

What does p4 change do?

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.

What does p4 Fstat do?

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.

What is sync p4?

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.


1 Answers

Pass the output of grep to xargs

grep -rl "pattern" * | xargs p4 edit
like image 112
Avinash Raj Avatar answered Sep 22 '22 12:09

Avinash Raj