The UNIX and Linux Forums  


Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
.
google unix.com




Thread: Order sorting
View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 12-02-2005
vino's Avatar
vino vino is offline Forum Staff  
Supporter (in vino veritas)
  
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,798
I dont think sed alone has the power to do that.

But couple it along with other tools and it can be done.

The result follows the spacing pattern of the input.


Code:
[~/temp]$ echo "01 B D A C" | sed -e 's/ /\n/g' | sort | tr '\n' ' '
01 A B C D