![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !! |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Append the data to first column | ravi_rn | Shell Programming and Scripting | 2 | 06-02-2009 01:08 PM |
| alter data in column | tintin72 | UNIX for Dummies Questions & Answers | 2 | 04-02-2009 07:40 AM |
| remove a column of data | jdhahbi | Shell Programming and Scripting | 1 | 01-22-2009 09:29 PM |
| Need to get the first column of data | bobk544 | Shell Programming and Scripting | 3 | 08-04-2007 04:35 PM |
| Column data reading | FarhanNaseer | Shell Programming and Scripting | 1 | 09-19-2005 12:02 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
counting the data in column
Hi power user,
I have data as follows aa bb bb aa aa bb bb aa bb cc cc bb bb cc zz ll ll zz zz ll and I want the output to be like this: aa bb 4 cc bb 3 zz ll 3 So, althrough the data in the column are arranged in a different order, they will be considered the same data. Is there any awk script which could do that? Tx |
|
||||
|
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 |
|
||||
|
Tx..It works as expected..
![]() |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Tags |
| columns, count words |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|