Description
For simplicity, we assume that a word is a sequence of lowercase alphabets.
You can extend the regular expressions used in the scripts to match
POSIX-defined words.
The job to do is reversing every word of a line.
|
| Raw Input
|
| Desired Output
| 112358 is a fibonacci sequence...
a test line
124816 1392781
final line...
|
| 112358 si a iccanobif ecneuqes...
a tset enil
124816 1392781
lanif enil...
|
|
Script and Comments
Script1 [ 1] s/[a-z][a-z]*/\n&/g
[ 2] :loop
[ 3] s/([a-z]*\n)([a-z])([a-z]*)/\2\1\3/g
[ 4] t loop
[ 5] s/\n//g
| |
|