[plug] Find similarly named files in directories

Timothy White weirdit at gmail.com
Sat Jan 13 13:21:48 WST 2007


On 1/13/07, Bernard Blackham <bernard at blackham.com.au> wrote:
> Lyndon Maydwell wrote:
> > find|ruby -e 'h={};STDIN.each{|l|l[/.*\/(.*)/];h[$1]||=[]<<l};p h'
> > 66 chars
>
> It could be 65 if you omitted the space between e and ', but ...
>
> > messy output, but technically works (or not?) :P
>
> I can't get this to work. It lists every file for me. Care to submit a
> patch? :)

For me, it "works". It returns a number of misses, and the output
needs to be sorted. Of course, the output is more than we need, being
a dump of an array I think. Adding a sed command to put new lines in,
and then a sort command, I can get some usable output.

But... I fail to see how ether of the following 2 match, unless this
script doesn't take into account the file extensions. (And they are
the only files with zzz in them).

 "zzz.ogg"=>["./PlaneShift/art/music/zzz.ogg\n"]
 "zzz.wav"=>["./PlaneShift/art/music/zzz.wav\n"]

>
> Ruby's one of those things I've been meaning to teach myself for a
> while, but never have. *sigh*

>
> Cheers,
> Bernard.
> _______________________________________________
> PLUG discussion list: plug at plug.org.au
> http://www.plug.org.au/mailman/listinfo/plug
> Committee e-mail: committee at plug.linux.org.au
>



I know that feeling. But I'm yet to have a project I need to learn it,
so I've not :P

Tim
-- 
Linux Counter user #273956
Don't email joeblogs at scouts.org.au



More information about the plug mailing list