Created
March 14, 2016 23:43
-
-
Save FernandoBasso/d211232fe215f175c3b5 to your computer and use it in GitHub Desktop.
Trying to understand how "reverse lines" in sed works
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
file: | |
AA | |
BB | |
CC | |
DD | |
sed command: | |
sed -n '1! G; h; $ p' | |
step/cmd PS HS STDOUT | |
------------------------------------------------------------------- | |
IL1 AA AA ␀ | |
h AA AA | |
IL2 BB BB AA | |
G BB\nAA AA | |
h BB\nAA BB\nAA | |
IL3 CC CC BB\nAA | |
G CC\nBB\nAA BB\nAA | |
h CC\nBB\nAA CC\nBB\nAA | |
IL4 DD DD CC\nBB\nAA | |
G DD\nCC\nBB\nAA CC\nBB\nAA | |
h DD\nCC\nBB\nAA DD\nCC\nBB\nAA | |
p DD\nCC\nBB\nAA DD\nCC\nBB\nAA DD\nCC\nBB\nAA | |
---- |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment