back toc next

Space Balls: Example

Print the first line as last

bash$ sed -n -e '1h;1!p;${g;p;}'
h: hold space <- pattern space
g: pattern space <- hold space

Emulation of tac

bash$ sed -n -e 'G;h;$p'
G: pattern space <<- '\n' hold space