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
Post a Comment