Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Compare two (or more) filenames and return what is common between them
On Mar 18, 8:23pm, Peter Stephenson wrote:
} Subject: Re: Compare two (or more) filenames and return what is common bet
}
} On Tue, 18 Mar 2014 03:05:27 -0400
} TJ Luoma <luomat@xxxxxxxxx> wrote:
} > What I am trying to do:
} >
} > Given a folder/directory full of files (and, possibly, some existing
} > folders/directories), I want to create folders which will group files
} > with similar files names, but which will leave folders alone.
}
} I'm still not quite sure after reading your description what it is you
} want
I suspect he wants something like this:
http://en.wikipedia.org/wiki/Approximate_string_matching
Zsh has such a function internally for "spelling" correction, but it is
actually based on correcting for typographical mistakes on a QWERTY
keyboard more than on traditional substring similarity.
You could also try something with the (#a) glob qualifier (approximate
matching) but it's VERY expensive for strings as long as some of your
example file names and is entirely impossible to interrupt once it is
started ("kill -9" territory).
Messages sorted by:
Reverse Date,
Date,
Thread,
Author