Is there a way to make
gnu sed be verbose about what is run and what is done ?
I'd like to have something like a "debug mode" so that I can see - for each line of input - the content of the hold space and pattern space before and after the script is run etc.
printf '%s\n' one two | sed --debug 'H;1h;$x;$s/\n/_/g'
the output is
SED PROGRAM: H 1 h $ x $ s/\n/_/g INPUT: 'STDIN' line 1 PATTERN: one COMMAND: H HOLD: \none COMMAND: 1 h HOLD: one COMMAND: $ x COMMAND: $ s/\n/_/g END-OF-CYCLE: one INPUT: 'STDIN' line 2 PATTERN: two COMMAND: H HOLD: one\ntwo COMMAND: 1 h COMMAND: $ x PATTERN: one\ntwo HOLD: two COMMAND: $ s/\n/_/g MATCHED REGEX REGISTERS regex = 3-4 ' ' PATTERN: one_two END-OF-CYCLE: one_two