Quoting roberto on 2010-01-23 15:33:53: > is there any linux built-in utilities to count how many times a string > occur in a text file ? I don't know of any actual utilities to do so, but there's a handy little pipeline that I use as a generic string-counter that, so far, works for all files I've tried, printable or not. $ strings $yourFile | grep -oe '$yourString' | wc -l where $your{File,String} are the file you want to search, and the string (actually a regex) you want to search for, respectively. These are extremely powerful commands, and from my experience are all fairly universal. For more information, see their relevant manpages: strings(1), grep(1), and wc(1). -- _ ASCII Ribbon Campaign Against ( ) Brian Ryans HTML E-mail and V-cards X BrianLRyans@gmail.com www.asciiribbon.org / \ GPG Public Key 0xC11213D0 Key Fingerprint: 8B2A 54C4 E275 8CFD 8A7D 5D0B 0AD0 B014 C112 13D0
Attachment:
signature.asc
Description: Digital signature