![]() |
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 |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Remove duplicate lines in log files | karthikn7974 | Shell Programming and Scripting | 4 | 03-21-2009 06:41 PM |
| Duplicate Files Finder 0.8.0 (Default branch) | iBot | Software Releases - RSS News | 0 | 06-02-2008 10:30 AM |
| removinf files containing duplicate data | asinha63 | AIX | 1 | 03-14-2006 03:07 PM |
| remove duplicate files in a directory | asinha63 | Shell Programming and Scripting | 1 | 03-13-2006 03:46 PM |
| Removing duplicate files from list with different path | vino | Shell Programming and Scripting | 10 | 05-12-2005 08:44 AM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
|
|
|||||
|
too many occurances to rm manually!
will this work... find ./path -iname "basename" | awk 'BEGIN{arr[$0]++}{var=[$0];var > 0; var++}END{i=[var++]}' | xargs mv --target-directory=dup-dir %rm dup-dir looks like it would work if i could use an array to parse the occurances starting with occurance 1 instead of 0... obviously this could be in any directory but the way the tree is configured it doesn't really matter as long as i have one occurance left! could please use some help... moxxx68 |
|
|||||
|
find ./path -print -exec basename {} \; | awk -v var=arr 'arr[$0]++;i >= 2; i$var' | xargs mv --target-directory=test..
this worked to a certain extent although I am getting some error messages with the cp command and the basename is contingious to all names of the same type (ex, file.txt-{1,2,3,4}) and I am not sure if this gives the exact result as far as leaving one file although i tried diff two test directories against each other it seemed real close.. please leave affirmation of any correct syntax used (if any?).. moxxx68 |
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|