zsh-users
 help / color / mirror / code / Atom feed
From: Peter Stephenson <p.w.stephenson@ntlworld.com>
To: Zsh-Users List <zsh-users@zsh.org>
Subject: Re: Compare two (or more) filenames and return what is common between them
Date: Fri, 21 Mar 2014 19:39:15 +0000	[thread overview]
Message-ID: <20140321193915.481066f3@pws-pc.ntlworld.com> (raw)
In-Reply-To: <CADjGqHstjyABkL6BqetJ7wHqGhE-3wc-toU8FsifkP3kMGqLmA@mail.gmail.com>

On Fri, 21 Mar 2014 15:02:52 -0400
TJ Luoma <luomat@gmail.com> wrote:
> So here are the steps simpler version of what I’d like to do (which, I
> realize, might not be possible to do in a shell script):
> 
> 1. Find all of the files (not directories) in a given directory (that
> directory would probably be “$@“ in most cases)
> 
> 2. Type the first ~4 letters of each filename
> 
> 3. Emulate {tab} for completion matching
> 
> 4. Create a directory based on the output> 
> Thanks!
> 
> TjL
 from step #3
> 
> 5. Move whatever files matched step #3 into the folder created in step 4
> 
> Is that more clear and/or possible?

No, that's much harder!  Hooking into completion is difficult.

However, it sounds like you're saying you'd be happy with collecting
files that happen to have any prefix in common, so you're not actually worried about completion, just about common prefixes.  That's probably simpler
than what I implemented, where I required the common prefixes to be
space delimited.  It's different in that you're now saying you'd like to
group by the shortest common string, whereas I've looked for the longest
common string first.

pws


  reply	other threads:[~2014-03-21 19:39 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-18  7:05 TJ Luoma
2014-03-18 20:23 ` Peter Stephenson
2014-03-18 21:42   ` Bart Schaefer
2014-03-21 19:02     ` TJ Luoma
2014-03-21 19:39       ` Peter Stephenson [this message]
2014-03-28 20:20   ` Peter Stephenson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20140321193915.481066f3@pws-pc.ntlworld.com \
    --to=p.w.stephenson@ntlworld.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).