Sometimes we land in a situation where we need to find all files in the system which does not contain a specific String.
I wrote a simple script to find a file without the string.
As a demonstration I used the file type as xml. You can customize it as per your requirement.
-----------------------------------------------------------
#!/bin/bash
typeset -i mRep
for mFile in `find . -name "*.xml"`
do
mRep=`egrep -c 'string' $mFile`
if [ $mRep -eq 0 ]; then
echo "File = "$mFile" does not contain 'string'"
fi
done
-----------------------------------------------------------
Feel free to write back if you have issues in implementing the same.
No comments:
Post a Comment