3.5. Debugging sed scripts
The following two debuggers should make it easier to understand how
sed scripts operate. They can save hours of grief when trying to
determine the problems with a sed script.
(1) sd (sed debugger), by Brian Hiles
This debugger runs under a Unix shell, is powerful, and is easy to
use. sd has conditional breakpoints and spypoints of the pattern
space and hold space, on any scope defined by regex match and/or
script line number. It can be semi-automated, can save diagnostic
reports, and shows potential problems with a sed script before it
tries to execute it. The script is robust and requires the Unix
shell utilities plus the Bourne shell or Korn shell to execute.
(2) sedsed, by Aurelio Jargas
This debugger requires Python to run it, and it uses your own
version of sed, whatever that may be. It displays the current input
line, the pattern space, and the hold space, before and after each
sed command is executed.