Welcome to The ABC’s of p4 grep!
Here we will explore the different flags for the p4 grep commands.
Much like regular grep, use the -C flag to show the context around the matching search term.
Suppose you have a file named test.txt with the following content:
sad
happy
awake
coffee
work
schoolYou would search for the word “happy” like this:
$ grep -e happy test.txt
//depot/test.txt#6:happyTo see the lines before and after “happy”, execute the following:
$ grep -C 1 -e happy test.txt
//depot/test.txt#6-sad
//depot/test.txt#6:happy
//depot/test.txt#6-awake