Hello dear members, im having linux bash script to search around 30 pathes for files that contains phrasses from my phrasses file. This is the command used: /bin/nice -n 19 grep -sRil "$phrasse" /home/$foldername/public_html >> filesmatchingphrasses There is quite big amount of phrasses and foldernames and search is done thru many files so i would like to allow grep (or any other linux command?) to examine only files of around 5 certain file types. Example: .php, .htm, .html I wanted to ask how can i modiffy my command? Or is there any command that is less intensive on server resources? ---- there is "find" alternative command, but i wish i use grep as i think find somehow did not worked properly to output files matching phrasses. there is an simply looking grep command but im little bit afraid to run it so it do not cause anything bad there appears to be good ideas for both grep and find Should i just add: --include=*.{html,php,htm} into my command? i added it after "-sRil" part and it appears to work
Xargs should help, something like this should do it: find /home/$foldername/public_html -type f -name '*.php' -or -name '*.htm' -or -name '*.html' | xargs grep "$phrasse" >> filesmatchingphrasses