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 UNIX Forums - Click on the Thread or Permalink to View Entire Thread -->
  #2 (permalink)  
Old 12-02-2005
vino's Avatar
vino vino is offline
Supporter (in vino veritas)
 

Join Date: Feb 2005
Location: Bangalore, India
Posts: 2,661
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
Reply With Quote