Tag: cat
Search in files and count lines
by z3n on Oct.27, 2009, under Linux Happyness
Problem:
I wanted to know how many occurences of a string appears on a log file, by ssh.
Solution:
cat file.ext | grep search_string | wc -l
cat will print the whole file contents, grep will search for the string, wc -l will count the lines.