Created
November 13, 2015 14:18
-
-
Save FabienArcellier/103b56022c35923985f2 to your computer and use it in GitHub Desktop.
findcode & display code command
This file contains hidden or 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
function findcode { | |
extension=$1 | |
pattern=$2 | |
find . -name "*.${extension}" | xargs grep -ni --colour=always ${pattern} | |
} | |
# Utility | |
function displaycode { | |
file=$(echo $1 | cut -f1 -d:) | |
line=$(echo $1 | cut -f2 -d:) | |
line=$(($line-10)) | |
if [[ $line -lt 1 ]]; then | |
line="1" | |
else | |
echo "not" | |
fi | |
sed -n "${line}, +20p" $file | |
echo "" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment