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
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$
© 2024 OneMinuteCode. All rights reserved.