|
|||||||
| Forums | Search Forums | Register | Forum Rules | Man Pages | Albums | FAQ | Members | 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 !! |
|
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
||||
|
||||
|
Remove Doubles Without Sort?
Hi!
I have concatenated two files which are wordlists, i.e., one word per line. The new file contains some doubles, but I cannot use sort and uniq as I need to keep the sort order that it is already in, which is not alphabetical, and uniq only compares adjacent lines, and the doubles are not on adjacent lines. Is there another simple way to remove doubles without altering the sort order? Unfortunately, there is no common pattern I can use to pick them out. |
| Sponsored Links | ||
|
|
#3
|
||||
|
||||
|
Hey bipinajith, thanks for your reply! Would you mind explaining how that pattern works? I thought I knew a little about regexes, but I've never seen anything like that.
|
|
#4
|
|||
|
|||
|
see the explanation:
http://www.unix.com/302678079-post2.html |
| The Following User Says Thank You to rdcwayx For This Useful Post: | ||
sudon't (12-12-2012) | ||
| Sponsored Links | |
|
|
#5
|
|||
|
|||
|
Quote:
It's an array with a string as the index. It checks if it's zero, then adds to it. The first time the index appears, it will print, the next times it won't. |
| The Following User Says Thank You to Corona688 For This Useful Post: | ||
sudon't (12-12-2012) | ||
| Sponsored Links | |
|
|
#6
|
||||
|
||||
|
Quote:
|
| Sponsored Links | |
|
|
#7
|
|||
|
|||
|
Look up associative array: Associative array - Wikipedia, the free encyclopedia
|
| The Following User Says Thank You to jim mcnamara For This Useful Post: | ||
sudon't (12-12-2012) | ||
| Sponsored Links | ||
|
![]() |
| Thread Tools | Search this Thread |
| Display Modes | |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| awk syntax mistake doubles desired output | awknewb123 | Shell Programming and Scripting | 6 | 03-07-2012 12:49 PM |
| remove duplicates and sort | dvah | Shell Programming and Scripting | 6 | 04-06-2011 11:14 AM |
| need help writing a program to look for doubles | rickym2626 | UNIX Desktop for Dummies Questions & Answers | 2 | 04-13-2009 03:46 PM |
| How to remove duplicate records with out sort | svenkatareddy | Shell Programming and Scripting | 19 | 06-11-2008 02:10 PM |
| long doubles | crashnburn | Programming | 1 | 12-19-2002 10:12 PM |
|
|