Is there a command-line utility app which can locate a specific block of lines in a text file?
- by fred.bear
The text "search and replace" utility programs I've seen, seem to only search on a line-by-line basis...
Is there a command-line tool which can locate one block of lines (in a text file), and replace it with another block of lines.?
For example: Does the test file file contain this exact group of lines:
'Twas brillig, and the slithy toves
Did gyre and gimble in the wabe:
All mimsy were the borogoves,
And the mome raths outgrabe.
'Beware the Jabberwock, my son!
The jaws that bite, the claws that catch!
Beware the Jubjub bird, and shun
The frumious Bandersnatch!'
I want this, so that I can replace multiple lines of text in a file and know I'm not overwriting the wrong lines.
I would never replace "The Jabberwocky" (Lewis Carroll), but it makes a novel example :)