[PLUG] Paragraph Counting Script

Joe Pruett joey at clean.q7.com
Mon Jul 13 22:40:41 UTC 2009


>   Does anyone have a working script that will count chunks of text separated
> by two newlines?
>
>   I have a plain text file with names, addresses, phone numbers, etc. and
> I'm curious how many distinct entities are in the file. Each line ends with
> a newline, but they are separated by a blank line. I'm sure that such a tool
> can be cobbled together from shell tools or any scripting language and,
> rather than re-inventing the wheel, I'd like to use one already written.

i think that:

awk 'BEGIN{RS=""}END{print NR}'

will give you what you want.



More information about the PLUG mailing list