![]() |
|
|
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 |
| changing first letter to CAPS | Krrishv | Shell Programming and Scripting | 22 | 08-24-2008 07:57 AM |
| using sed to add letter after variable | outthere_3 | Shell Programming and Scripting | 2 | 02-04-2008 08:17 PM |
| get only two letter from any string | rinku | Shell Programming and Scripting | 2 | 01-18-2008 06:07 AM |
| what is dead.letter ?? | jambesh | Shell Programming and Scripting | 2 | 08-30-2006 04:25 AM |
| dead.letter | unisam | UNIX for Dummies Questions & Answers | 6 | 03-31-2004 03:33 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
Hello again,
Since I am UNIX new user I have this question: I have this file: 1 A A 1 A A 1 A A 1 B B 1 B B 1 X X 1 X X 1 C C Could anyone of you help me to sort this file like this: (I need all A and X together) 1 A A 1 A A 1 A A 1 X X 1 X X 1 B B 1 B B 1 C C I appreciate all your help! |
|
||||
|
sort doesn't work that way. You can try using some kind of text filter. Assuming you have a file - somefile Code:
# get everything in order sort somefile -o somefile # put the A data out to a new file grep '1 A' somefile > newfile # put the X out to the same new file grep '1 X' somefile >> newfile # put everything that is not A and not X out to the new file grep -v '1 A' somefile | grep -v '1 X' >> newfile |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|