The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

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




View Single Post in the UNIX and Linux Forums - Click on the Thread or Permalink to View Entire Thread -->
  #5 (permalink)  
Old 07-03-2009
anjas anjas is offline
Registered User
  
 

Join Date: Mar 2009
Location: Bali, Indonesia
Posts: 17
So, this what I do. The content of the file is as follow:

try.txt

aa bb
bb aa
aa bb
bb aa
bb cc
cc bb
bb cc
zz ll
ll zz
zz ll

I did the usual sort command:

sort try.txt |uniq -c > try.sort

The content of try.sort is:
2 aa bb
2 bb aa
2 bb cc
1 cc bb
1 ll zz
2 zz ll

What I need is the output to be like this
aa bb 4
cc bb 3
zz ll 3
I think, the script should included, how to switch the data in the same order. For example:

zz ll
ll zz
zz ll

should be changed to
zz ii
zz ii
zz ii

Is there any clue for it? Tx