I have many files on UNIX and wish to fetch number in that file associated with a specified pattern.
Most of the file will have a unique pattern in file like below
some text abc some text abc some text abc (3 rows)
The number could vary from file to file, it could be 35644 or any numeric value as well.
I want to find that number using grep or sed not awk. so far I was able to get this. I want to do this using single line unix command including redirection if applicable.
grep 'rows' file.txt
Edit - Removed the requirement if pattern is not found what should happen.