Add the following to your ~/.bash_aliases file and then source ~/.bashrc:
findinRfun() { if [ -z "$1" ] then echo "No argument supplied" else #search text is passed as argument $1 find . -type f \( -name "*.R" -o -name "*.Rmd" -o -name "*.r" -o -name "*.rmd" \) -print0 | xargs --null grep --with-filename --line-number --no-messages --color --ignore-case "$1" fi } alias findinR=findinRfun
Now, at the command line, you can search through all the files below the current location that contain your search text.
findinR mysearchtext
No comments:
Post a Comment