right justify each line?
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Assume each line in input.x has the same length.
$ cat input.x
99
99
9
9 9
99999
I want to right justify each line, so output.x would be:
$ cat output.x
99
99
9
9 9
99999
What is simplest way to convert input.x to output.x?
I tried the following, but does not work, because of greedy evaluation,
\2 always encompasses the entire line.
$ sed "s/^\(.*\)\( *\)$/\2\1/" input.x
Thanks,
Daniel