I want to publish a debug print so that I can follow the sed process.

Asked 1 years ago, Updated 1 years ago, 98 views

I'd like to understand the sed command, but it's hard to understand how it's entered into pattern space and hold space and processed with commands just by command description and imagination.

I don't think it's possible to visualize what's in the pattern space and hold space and how commands change, such as putting debug prints into the sed source code. If you know any of the articles that have already explained sed in that way, could you tell me?

Currently, we are unraveling the following.
http://ftp.gnu.org/gnu/sed/sed-4.4.tar.xz

sed

2022-09-30 18:55

1 Answers

Although slightly different from the debug print, sedsed allows you to view pattern and hold spaces sequentially.

$echo$'a\nb\nc' | sedsed.py --debug-ne'1!G;$p;h'
PATT:a$
HOLD: $
COMM: 1!G
PATT:a$
HOLD: $
COMM: $p
PATT:a$
HOLD: $
COMM:h
PATT:a$
HOLD: a$
PATT:b$
HOLD: a$
COMM: 1!G
PATT:b\na$
HOLD: a$
COMM: $p
PATT:b\na$
HOLD: a$
COMM:h
PATT:b\na$
HOLD: b\na$
PATT:c$
HOLD: b\na$
COMM: 1!G
PATT:c\nb\na$
HOLD: b\na$
COMM: $p
c
B
a
PATT:c\nb\na$
HOLD: b\na$
COMM:h
PATT:c\nb\na$
HOLD: c\nb\na$


2022-09-30 18:55

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.