SHOAIB MOHMMAD
SHOAIB MOHMMAD

Reputation: 45

Is there a way to extract only CL number and username from p4 changes

p4 changes command will give me change list number, date, user by whom submitted, changelist description but how to extract only CL number and user name?

Upvotes: 2

Views: 1546

Answers (2)

jamesdlin
jamesdlin

Reputation: 90095

You'll need to parse the output from p4 manually, but you might find it easier to do so by using p4 -z tag COMMAND, which generates more parsable output.

For example, p4 -z tag changes changes -s submitted -m 1 will output:

... change 123456
... time 1384458979
... user james
... client james-p4
... status submitted
... changeType public
... path //depot/some/path...
... desc Some truncated description

Upvotes: 1

Paul
Paul

Reputation: 4440

Perhaps not the pretties way to do it, but this works for me:

 p4 changes | awk '{print $2" "$6}' | sed "s/\@[^\n]*//"

First, awk extracts the changelist number ($2, i.e. column 2) and the username@workspace ($6, i.e. column 6). Then sed removes the @<workspace>.

Upvotes: 1

Related Questions