~ overflow ~

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.

Leave a Comment :, , , , , , , more...

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!