![]() |
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 |
| removing duplicates based on key | pukars4u | Shell Programming and Scripting | 1 | 05-21-2008 03:50 PM |
| removing duplicates from a file | trichyselva | UNIX for Dummies Questions & Answers | 2 | 03-25-2008 10:49 AM |
| Sort, Uniq, Duplicates | Amruta Pitkar | Shell Programming and Scripting | 5 | 05-17-2007 01:49 AM |
| Removing duplicates [sort , uniq] | sharatz83 | Shell Programming and Scripting | 4 | 07-14-2006 05:12 PM |
| Removing duplicates | giannicello | Shell Programming and Scripting | 12 | 09-14-2005 06:12 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
||||
|
removing duplicates and sort -k
Hello experts,
I am trying to remove all lines in a csv file where the 2nd columns is a duplicate. I am try to use sort with the key parameter sort -u -k 2,2 File.csv > Output.csv File.csv File Name|Document Name|Document Title|Organization Word Doc 1.doc|Word Document|Sample Doc|Org 1 Exl Doc 1.xls|Excel Sheet|Sample Sheet|Org 2 Pdf File 1.pdf|Pdf|Sample pdf|Org3 Exl Sheet 2.xls|Excel Sheet|Test Spreadsheet|Org 2 I want Output.csv to remove the 2nd Excell Sheet line Output.csv File Name|Document Name|Document Title|Organization Word Doc 1.doc|Word Document|Sample Doc|Org 1 Exl Doc 1.xls|Excel Sheet|Sample Sheet|Org 2 Pdf File 1.pdf|Pdf|Sample pdf|Org3 I believe the -k option uses spaces to determine the start and end fields My file seperator is a '|' so I want to remove the line with the duplicate Document Name (2nd column). Can this be done using the -k option of sort or is there another way to perform this task? thanks |
![]() |
| Bookmarks |
| Tags |
| nawk, sort |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|