Another Unix Tip
How to count the instances of a given character in a file? grep -c
won’t do it - instead it counts the number of maching lines. You need:
cat foo.c | tr -c -d ';' | wc -c
Which counts all the semicolons in foo.c
. (source)
Unix - it’s the OS that won’t cop out when there’s text all about! (source)
3 Comments