I have this script – it’s not working. I want the script to return a list of all files in which the keyword ‘keyword’ occurs two times.
#!/bin/bash
for file in * ; do
if [ $(grep 'keyword' $file | wc -l) -eq 2 ]
then
echo $file
fi
done
Use