Instantly share code, notes, and snippets.

Embed
What would you like to do?
findcode & display code command
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