Skip to content

Instantly share code, notes, and snippets.

@napsternxg
Last active December 14, 2015 23:59
Show Gist options
  • Save napsternxg/5169271 to your computer and use it in GitHub Desktop.
Save napsternxg/5169271 to your computer and use it in GitHub Desktop.
Search for text in files opened in the current folder in the current work space in Perforce. I would suggest using the part before the string passed to grep as an alias in your bashrc so you can use something like grep_p4o "text to search" directly.
alias grep_p4o='p4 opened | (folder="${PWD##*/}"; sed -e "s/.*${folder}\/\(.*\)#.*/\1/g") | xargs -o grep --color=auto -H'
p4 opened | (folder="${PWD##*/}"; sed -e "s/.*${folder}\/\(.*\)#.*/\1/g") | xargs -o grep --color=auto -H "text to search"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment