[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: string occurrences



roberto wrote at 2010-01-23 15:33 -0600:
> is there any linux built-in utilities to count how many times a string
> occur in a text file ?

grep "string" file | wc -l

will give you the number of *lines* that contain a specific string.  Only 
counts 1 if the string exists twice in a line, or 0 if it spans multiple lines.

Attachment: signature.asc
Description: Digital signature


Reply to: