Skip to content

Instantly share code, notes, and snippets.

@emanuele6
Last active August 12, 2026 21:12
Show Gist options
  • Select an option

  • Save emanuele6/4bf94faca24143db02175dbe7a434c93 to your computer and use it in GitHub Desktop.

Select an option

Save emanuele6/4bf94faca24143db02175dbe7a434c93 to your computer and use it in GitHub Desktop.
POSIX ed script that adds a | to the middle of every line (round down)
g/^/s/.*/a&a/\
s/^\(.\(..\)*\)$/b\1/\
t -\
s/^/X/
2s/../Y\
/g
2,$g/^X/+s/../%/g
g/^Y/?^[Xx]?t .\
s/.\(.*\)./x\1/\
?^[Xy]?t .\
s/../y/
g/^X/;/^$/-3d\
s/^.b\{,1\}.\(.*\)/\1|/\
+s/.\(.*\).$/\1/\
-,+j
w
q
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment