bash - use file comand instead of -name -


i want write shell script searches in .txt files word cat , replaces mouse.i wrote following code:

!/bin/bash  read directory  f in ` find $directory -name '*.txt' -type f`         echo $f     `sed -i "s/\<cat\>/mouse/g" $f`     done 

i supposed use "file" command.i searched , seems file command finds files of type.i want know how can include command in script.

assuming in directory *.txt files are. can execute following command:

find . -name *.txt -exec sed -i "s/\<cat\>/mouse/g" "{}" \; 

Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -