[plug] Find similarly named files in directories (golf match)

Lyndon Maydwell maydwell at gmail.com
Sat Jan 13 23:00:03 WST 2007


find|sed 's/.*\///'|sort|uniq -d
        offending filenames, no paths listed, 32 characters

However, as this doesn't list the path, you must run find or something
on the names output for you to be able to handle them, this can be
solved with a short xargs like function. I was sure that there would
be a way to do this with xargs, but apparently there isn't. Also, this
method is seriously slow compared to the others. If someone finds a
tool that replicates asdf though (there must be one right? I mean this
is a fairly useful thing to do), it does win on the character count.
at ~50 characters.

asdf () {
	local a
	while read a
	do
		$* $a
	done
}
find|sed 's/.*\///'|sort|uniq -d|asdf find ./ -name

unix tools win again



More information about the plug mailing list