Friday, July 25, 2008

Count chars

We might have had this one before but I couldn't find it.

cat commafile.txt | tr -dc ',' | wc -c

That could be replaced by any file in the commfile.txt. So, basically count the number of occurrences of the expression ',' in the file and print it out. Why? you ask - cos I gotta.

No comments: