[plug] Find similarly named files in directories (golf match)
Bernard Blackham
bernard at blackham.com.au
Sun Jan 14 14:48:16 WST 2007
Lyndon Maydwell wrote:
> 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),
I think you're after xargs -n1 :
find|sed 's#.*/##'|sort|uniq -d|xargs -d\\n -n1 find -name
58 (needs the -d\\n to be immune to filenames with spaces). Still, that
certainly wins on characters, and readability IMHO! :)
Bernard.
More information about the plug
mailing list