Last active
August 29, 2015 13:56
-
-
Save vrutberg/9206768 to your computer and use it in GitHub Desktop.
Handy .profile stuff
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# finds files that by filename matches $1, does not reside in a target folder, and contains the string $2 | |
findgrep() { | |
find . -name "*$1*" -and -type f -and -not -path "*/target/*" -and -not -path "*/.git/*" -print0 | xargs -0 fgrep -n --color=auto "$2" | |
} | |
# searches pom.xml files for $1 | |
alias poms="findgrep 'pom.xml' $1" | |
# copies the output of the last command to the clipboard | |
copylast() { | |
fc -s | pbcopy | |
} | |
# will show you how many commits there are that matches $1 | |
numcommits() { | |
git log --grep "$1" --oneline | wc -l | |
} | |
# find the first file matching $1 and copy its path to the clipboard | |
findcp() { | |
file=$(find $PWD -name "$1" | head -n 1) | |
echo "$file" | |
echo "$file" | tr -d "\n" | pbcopy | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment