0

What is the command to: Modify the "cat" command to automatically number paragraphs. These are separated by a single blank line.

Leo Rogers
  • 19
  • 3

2 Answers2

0

If you want to actually modify the cat command, the source can be found here; feel free to check it out and do whatever you like with it for your local compilation. However, such a patch is unlikely to make it into any distribution of coreutils.

DopeGhoti
  • 73,792
  • 8
  • 97
  • 133
  • Thanks but I am not trying to do that. I just want to use something like "cat -n" but not sure what the command is to just number paragraphs instead of every line. – Leo Rogers Jan 27 '17 at 17:50
0

If you check the man page, you will see that you can number non-blank lines, but I don't see any options for paragraphs. You will probably need a perl script that increments a variable every time the input line is ^$.

hymie
  • 1,700
  • 9
  • 16