[TriLUG] Search for Duplicate Filename, Ignore Extension

Brian Blater brb.lists at gmail.com
Wed Nov 2 14:48:26 EDT 2011


On Wed, Nov 2, 2011 at 2:40 PM, Robert Dale <robdale at gmail.com> wrote:
> Numbers and greedy matching were messing it up. Also added
> case-insensitive to sort + uniq.
>
> cat files.txt | cut -f 1 -d '#' | sort -f | uniq -ic | grep -v "^\s*1"
> | awk '{print $2}' | while read dupe; do grep -i ${dupe}\# files.txt;
> done
>
> On Wed, Nov 2, 2011 at 2:25 PM, Brian Blater <brb.lists at gmail.com> wrote:
>> awk '{print $2}' | while read dupe; do grep -i ${dupe}\# /another/path/files.txt;
>
>
>
> --
> Robert Dale

Awesome! That did it.

I need to learn more about awk, grep, sed etc, because the only change
I saw was in the grep statement (well other the the -i to ignore case:

1st: grep -v "^.*1"
2nd: grep -v "^\s*1"

Thanks,
Brian



More information about the TriLUG mailing list