I need to count the lines from matching config file entries, preferably with 'grep'.
- by Chris
I have a configuration file that has entries for various devices, with each entry separated by a blank line. I need to search the file for all instances of a given device type, and count the number of non-blank lines following the occurrence, stopping at the first blank.
For example:
Server=foo
config line 1
config line 2
config line 3
Server=bar
config line 1
config line 2
Server=foo
config line 1
If I wanted to know how many total "config lines" were associated with server "foo", I should get four. Can you please help?