Re: right justify each line?

"[email protected] [sed-users]" <[email protected]>
Newsgroups gmane.editors.sed.user
Message-ID <[email protected]>
Pls. ignore the prev. soln., which is incorrect.
 

 sed -e '

    s/\([^-].*[^-]\)\(.*\)/\2\1/;t
    s/\([^-]\)\(.*\)/\2\1/
 '  yourfile
 

 

 There are 2 types of lines of interest:
  a)   move what is to the right of the rightmost nondash to the left of the leftmost nondash.
  b) move everything to the right of the solitary nondash to it's left.
 

 N.B. Order of processing lines above is IMP. Must not be changed.
 

 All other lines left as they were found.
 

 -Rakesh


[Non-text portions of this message have been removed]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.