#!/bin/sed -f
# rev
# Reimplement the 'rev' command from util-linux-ng

/../! b
     
# Reverse a line.  Begin embedding the line between two newlines
s/^.*$/\
&\
/

# Move first character at the end.  The regexp matches until
# there are zero or one characters between the markers
tx
:x
s/\(\n.\)\(.*\)\(.\n\)/\3\2\1/
tx
     
# Remove the newline markers
s/\n//g
