Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
List ALL files modified in last 24hrs OR list atleast 10 recent files
- X-seq: zsh-users 18585
- From: Amm <ammdispose-zsh@xxxxxxxxx>
- To: "zsh-users@xxxxxxx" <zsh-users@xxxxxxx>
- Subject: List ALL files modified in last 24hrs OR list atleast 10 recent files
- Date: Tue, 11 Mar 2014 18:25:56 +0800 (SGT)
- Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s1024; t=1394533556; bh=0UTCq4CFhnVIdyceuvLQJxJa1sxyF3CsdcG61vTvY3I=; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=Q6MaN9E/m9vjbPPuTWP8sQEty2goQCpiXYVtjfqmn7oP+q2OOP149gTkYGbWyzj+gd/nmN2M/n5sbZy2ZOc0lWtEwJNlhxB8oMie4VVlr2Q9ehk/6vEpEpdY3GPLknG1JKhx2wJBpgRh15TjkG3JyGXIRPfJSa5Hc6/JD284ZKc=
- Domainkey-signature: a=rsa-sha1; q=dns; c=nofws; s=s1024; d=yahoo.com; h=X-YMail-OSG:Received:X-Rocket-MIMEInfo:X-Mailer:Message-ID:Date:From:Reply-To:Subject:To:MIME-Version:Content-Type:Content-Transfer-Encoding; b=2NDk7mIV7limG/KC0sMuhGHPwn9AKFDLadLdyIcOA2UL3xFxvw5cEj8d6BlVWD14rSAOerVqjnfRbmE5ISgP+FKx/6k/X/Ay1BxwZB7Af0PBHSryny0dz6Uw7nXvx3ADO12GAknw5Ub2TehNwpuu+0hoTd1KO49czHWJQ15KyW4=;
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- Reply-to: Amm <ammdispose-zsh@xxxxxxxxx>
Hello,
I am trying to combine two patterns.
1) List plain files modified in last 24hrs (older to newer)
ls -lU *(.mh-24Om) # thats 24, capital oh
This works fine
2) List 10 most recent files (older to newer)
ls -lU *(.Om[-10,-1])
This also works fine.
Now I want to combine (OR) these two such that:
Case 1)
If there are more than 10 files modified in 24hrs
then list them all (not just 10)
Case 2)
If there are, say 7, files modified in last 24hrs
then list those 7 + 3 other most recent files
(listing total 10 most recent files)
I referred to this page:
http://zsh.sourceforge.net/Doc/Release/Expansion.html
(Section 14.8.7 Glob Qualifiers)
I tried:
1) ls -lU *(.mh-24Om[-10,-1])
This (as expected) ANDs the result not OR.
2) ls -lU *(.mh-24,.Om[-10,-1])
Now as per above link:
Comma ORs the pattern so logically first one will pick
files of last 24hrs, next will pick most recent
10 files, both will be ORed (union)
But then in that link there is one line which says:
"Some qualifiers,
however, affect all matches generated,
independent of the sublist in
which they are given.
These are the qualifiers ...and brackets (‘[...]’)"
Which means [-10,-1] is applied at end, effectively
reducing list to 10 files. (even if there are more than
10 files modified in last 24hrs)
I tried several other ways but did not work.
Like:
ls -rlU --sort=time *(.mh-24) *(.Om[-10,-1])
But this causes duplicate entries, plus it fails
if there is nofile modified in last 24hrs.
I want to do it in a single statement not via multiple
commands.
So how do I achieve this? Any idea?
Thanks in advance.
Amm.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author