I am trying to write a shell script that counts the number of occurrences of a string in a file and take some action based on it.
Here is my script:
#!/bin/sh if [ grep "\s*oplocks\s=" sample.txt | wc -l = 5 ] then echo "cnt equals 5" else echo "cnt not 5" fi
grep, I also want to count the number of occurrences so I am using
wc -l. How can I put this in a
Thanks for your help!