Raw Input
How are you? I am fine...
Desired Output
...enif ma I ?uoy era woH
Script and Comments
Script1
[ 1] s/$/\n/
[ 2] :loop
[ 3] s/\(.\)\(\n.*\)/\2\1/
[ 4] t loop
[ 5] s/^\n//
Comments
  1. We divide the Pattern Space into to two parts separated by a newline character, which is appended to the Pattern Space by Step [1].
  2. Initially, the first part containing the line.
  3. Steps [2] thru [4] constitute a loop:
    • In each iteration, we move the first character of the first part to the end of the second part.
    • Iteration repeats until no more character left in the first part.
    • When substitution performed by Step [3] succeeds, Step [4] makes sed branch back to Step [2] then [3] to see whether further substitution is possible.
  4. Step [5] is used to remove the separating newline character.