How to count the number of a particular string in a file?
Posted on 2000-04-18
I wonder how to count the number of appearances of a particular string in a file? grep -c can only find the number of lines that contain the string.
Another question is how to substitue a non-printable character into a return
character "\n" using sed? The following command seems doesn't work.
#top -d 1 >f1
#sed "1,$ s/\033/\012/g" f1
Why? Here \033 stands for ASCII code 033 which displays as ^[ (non-printable),
\012 is "carriage return".