here are two commands I made a while back and some of you may find handy to find and replace stuff on the terminal:
Find JS files with stuff
:
findjs stuff
Find .view files with border
:
findview border
They also have a replace counter part in place by adding an r
at the end of the commands:
findviewr border muahaha
findjsr stuff nope
Add this to your ~/.bash_profile
:
function findjs {
find . -name '*.js' -not -path '*/node_modules/*' -not -path './deploy/cdm/*' -not -path './public/*' -not -path './bundle/*' -not -path './brain/*' -not -path './*.tmp.*' -exec grep "$1" {} \; -print
}
function findjsr {
find . -name '*.js' -not -path '*/node_modules/*' -not -path './deploy/cdm/*' -not -path './public/*' -not -path './bundle/*' -not -path './brain/*' -not -path './*.tmp.*' -exec sed -i "s/$1/$2/g" {} \; -print
}
function findview {
find . -name '*.view' -not -path '*/node_modules/*' -not -path './deploy/cdm/*' -not -path './public/*' -not -path './bundle/*' -not -path './brain/*' -not -path './*.tmp.*' -exec grep "$1" {} \; -print
}
function findviewr {
find . -name '*.view' -not -path '*/node_modules/*' -not -path './deploy/cdm/*' -not -path './public/*' -not -path './bundle/*' -not -path './brain/*' -not -path './*.tmp.*' -exec sed -i "s/$1/$2/g" {} \; -print
}