Re: right justify each line?
| Newsgroups | gmane.editors.sed.user |
|---|---|
| Message-ID | <SN1PR13MB05920FEF5723585ACEB380F6B9100@SN1PR13MB0592.namprd13.prod.outlook.com> |
Your input.x = output.x and also what do you mean each line in input.x has the same length? look at the line 99999. You need to post sensibly first. ________________________________ From: [email protected] <[email protected]> on behalf of Daniel Goldman [email protected] [sed-users] <[email protected]> Sent: Saturday, November 14, 2015 9:25 AM To: [email protected] Subject: right justify each line? 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 [Non-text portions of this message have been removed]