Delete all such lines from a file that contains the word “MCA”.
echo -e "Enter the pattern : \c"
read ptrn
cnt=0
for i in `ls -1`
do
if [ -f $i ]
then
l=`grep -E $ptrn $i|wc -l`
if [ $l -gt 0 ]
then
rm $i
echo "$i is deleted....."
fi
fi
done
Output
Enter the pattern : mca
temp.sh is deleted.....