[plug] Find similarly named files in directories
Carl Gherardi
carl.gherardi at gmail.com
Sat Jan 13 05:18:02 WST 2007
On 1/12/07, Timothy White <weirdit at gmail.com> wrote:
> Ok, so 2 simple sed's and I solve the space problem!! Not sure if
> there are any other "bugs"
>
> find| sed 's/\ /:::/g' |sed -r 's/.*\/(.*)/\0 \1/'|sort -i -k 2|uniq
> -i --all-repeated=separate -f 1| sed 's/[^ ]*$//' | sed 's/:::/\ /g'
>
> Rather simple, first check no file name as 3 :'s in a row, if it does,
> find another "uniq" sequence to replace it with.
Was a challenge for golf originally an i'm bored. 138 chars is benchmark.
Slight shave - remove long options and a couple of seds:
find . -printf "%h/%f:::%f\n" | sort -i -k 2 | uniq -i -D -f 1 | sed
's/:::.*$//'
99 chars
Pretty sure that still good for whitespace. Same qualification for
files with ::: in the name.
Carl G
More information about the plug
mailing list