zsh-users
 help / color / mirror / code / Atom feed
From: Meino Christian Cramer <Meino.Cramer@gmx.de>
To: Stephane_Chazelas@yahoo.fr
Cc: zsh-users@sunsite.dk
Subject: Re: OT: How to list all but the last item
Date: Mon, 18 Sep 2006 19:23:30 +0200 (CEST)	[thread overview]
Message-ID: <20060918.192330.29569625.Meino.Cramer@gmx.de> (raw)
In-Reply-To: <20060918171752.GA4980@sc>

From: Stephane Chazelas <Stephane_Chazelas@yahoo.fr>
Subject: Re: OT: How to list all but the last item
Date: Mon, 18 Sep 2006 18:17:52 +0100

> On Mon, Sep 18, 2006 at 06:39:59PM +0200, Meino Christian Cramer wrote:
> > Hi,
> > 
> >  may be this is a very stupid question...and may be I am blind...
> >  But...
> > 
> >  I want to contruct a loop like
> > 
> >  for i in `<cmd>`
> >  do
> >    <do something> ${i}
> >  done
> > 
> >  and <cmd> should return a list of items matched by a regexp
> >  or another kind of qualifier and skipping the last item.
> > 
> >  Example:
> > 
> >  ls -rtlc * | <???what???>
> > 
> >  would return every item in a directory exept the newest one.
> 
> -c is to sort of the file change-status time. You want file
> modification time, it's ls -rtl.
> 
> And it should be
> 
> ls -rtl | ...
> 
> Or
> 
> ls -rtld -- * | ...
> 
> >  Is there any way to accomplish with something fitting in on
> >  a commandline???
> 
> ls -tl | tail +2
> 
> ls -trl | sed '$d'
> 
> Also:
> 
> ls -trld -- *(om[2,-1])
> 
> Also:
> 
> IFS=$'\n\n'
> lines=( $(cmd) )
> for line in "${(@)lines[1,-2]}"; do ...; done
> 
> -- 
> Stéphane
> 

Hi Stephane,

 thanks a lot for your reply! :)
 
 Now I have many solutions to choose from :))

 Keep hacking!
 mcc


      reply	other threads:[~2006-09-18 17:23 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-18 16:39 Meino Christian Cramer
2006-09-18 17:02 ` Will Maier
2006-09-18 17:17   ` Meino Christian Cramer
2006-09-18 17:17 ` Stephane Chazelas
2006-09-18 17:23   ` Meino Christian Cramer [this message]

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=20060918.192330.29569625.Meino.Cramer@gmx.de \
    --to=meino.cramer@gmx.de \
    --cc=Stephane_Chazelas@yahoo.fr \
    --cc=zsh-users@sunsite.dk \
    /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).