§ Copy all *.php and *.html files that contain the word 'security' into a seperate directory

Hi Guys,

Copy all *.php and *.html files that contain the word 'security' into a seperate directory using shell script or through command

thanks
LVL 10
gg234Asked:
Who is Participating?
 
ravenplConnect With a Mentor Commented:
find /source/dir -type f -name '*.html' -o -type f -name '*.php' | while read fn; do
 grep -q 'security' "$fn" && cp -f "$fn" /destination/dir
done
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.