Linux Archive

Linux Archive (http://www.linux-archive.org/)
-   Fedora User (http://www.linux-archive.org/fedora-user/)
-   -   wildcards to list a group of files in sequential numerical order ? (http://www.linux-archive.org/fedora-user/595577-wildcards-list-group-files-sequential-numerical-order.html)

linux guy 11-07-2011 05:54 PM

wildcards to list a group of files in sequential numerical order ?
 
On Mon, Nov 7, 2011 at 11:29 AM, Miner, Jonathan W (US SSA)
<jonathan.w.miner@baesystems.com> wrote:

> Not sure that shell globbing will work here... but you could do something like this in bash:
<snip>

Thanks for confirming that. I wanted to make sure I wasn't missing
something easy.

Also, thanks to whomever fixed my bounced post to the group !
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

Patrick O'Callaghan 11-07-2011 06:17 PM

wildcards to list a group of files in sequential numerical order ?
 
On Mon, 2011-11-07 at 10:28 -0700, linux guy wrote:
> I'd like to list all the files with names between DSC_6035.NEF and
> DSC_6072.NEF.
>
> How do I do this ?
>
> I tried using DSC_[6035-6072].NEF, but that doesn't work. It lists
> files outside the desired range.

[6035-6072] means "any single character equal to one of
6,0,3,5,'lexically between 5 and 6 inclusive',6,0,7,2".

IOW any single character in the set {0,2,3,5,6,7}.

poc

--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

Robert Nichols 11-07-2011 08:09 PM

wildcards to list a group of files in sequential numerical order ?
 
On 11/07/2011 12:54 PM, linux guy wrote:
> On Mon, Nov 7, 2011 at 11:29 AM, Miner, Jonathan W (US SSA)
> <jonathan.w.miner@baesystems.com> wrote:
>
>> Not sure that shell globbing will work here... but you could do something like this in bash:
> <snip>
>
> Thanks for confirming that. I wanted to make sure I wasn't missing
> something easy.

You might try doing that with a shell sequence operator instead of globbing:

ls DSC_{6035..6072}.NEF

That's going to blindly generate all the numbers in that sequence without
regard to whether all those files actually exist, so you might want to
redirect stderr to /dev/null to get rid of the complaints from 'ls'.

--
Bob Nichols "NOSPAM" is really part of my email address.
Do NOT delete it.

--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

Rich 11-07-2011 08:16 PM

wildcards to list a group of files in sequential numerical order ?
 
On 11/7/2011 1:54 PM, linux guy wrote:
> On Mon, Nov 7, 2011 at 11:29 AM, Miner, Jonathan W (US SSA)
> <jonathan.w.miner@baesystems.com> wrote:
>
>> Not sure that shell globbing will work here... but you could do something like this in bash:
> <snip>
>
> Thanks for confirming that. I wanted to make sure I wasn't missing
> something easy.
>
> Also, thanks to whomever fixed my bounced post to the group !

I believe what you want is DSC_60{3[5-9],[4-6][0-9],7[0-2]}.NEF
No virus found in this outgoing message.
Checked by AVG - www.avg.com
Version: 9.0.920 / Virus Database: 271.1.1/4002 - Release Date: 11/07/11 02:35:00
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

suvayu ali 11-07-2011 08:51 PM

wildcards to list a group of files in sequential numerical order ?
 
On Mon, Nov 7, 2011 at 22:09, Robert Nichols <rnicholsNOSPAM@comcast.net> wrote:
> You might try doing that with a shell sequence operator instead of globbing:
>
> * *ls DSC_{6035..6072}.NEF
>
>

To add to that for completeness, this is known as brace expansion. For
a detailed discussion, see man bash under "Brace Expansion".

HTH

--
Suvayu

Open source is the future. It sets us free.
--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

g 11-07-2011 08:56 PM

wildcards to list a group of files in sequential numerical order ?
 
On 11/07/2011 05:28 PM, linux guy wrote:
> I'd like to list all the files with names between DSC_6035.NEF and
> DSC_6072.NEF.
>
> How do I do this ?

if you can handle a few before and after, use;

ls DSC_60[37]?.NEF.

if not;

ls DSC_603[5-9].NEF;ls DSC_60[4-6]?.NEF;ls DSC_607[0-2].NEF

there are some tricks you could use by redirecting to a file and then
listing from file, but that would involve a lot more and you would have
everything in a single column. which would be ok if using 'ls -l'.


hth
--

peace out.

tc.hago,

g
.

*please reply "plain text" only. "html text" are deleted*

****
in a free world without fences, who needs gates.
**
help microsoft stamp out piracy - give linux to a friend today.
**
to mess up a linux box, you need to work at it.
to mess up an ms windows box, you just need to *look* at it.
**
The installation instructions stated to install Windows 2000 or better.
So I installed Linux.
**
learn linux:
'Rute User's Tutorial and Exposition' http://rute.2038bug.com/index.html
'The Linux Documentation Project' http://www.tldp.org/
'LDP HOWTO-index' http://www.tldp.org/HOWTO/HOWTO-INDEX/index.html
'HowtoForge' http://howtoforge.com/
****

--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines

g 11-07-2011 09:05 PM

wildcards to list a group of files in sequential numerical order ?
 
On 11/07/2011 09:51 PM, suvayu ali wrote:
<>

> To add to that for completeness, this is known as brace expansion. For
> a detailed discussion, see man bash under "Brace Expansion".

forgot about that trick. 8-(

good to see Rich did not. 8-)


--

peace out.

tc.hago,

g
.

*please reply "plain text" only. "html text" are deleted*

****
in a free world without fences, who needs gates.
**
help microsoft stamp out piracy - give linux to a friend today.
**
to mess up a linux box, you need to work at it.
to mess up an ms windows box, you just need to *look* at it.
**
The installation instructions stated to install Windows 2000 or better.
So I installed Linux.
**
learn linux:
'Rute User's Tutorial and Exposition' http://rute.2038bug.com/index.html
'The Linux Documentation Project' http://www.tldp.org/
'LDP HOWTO-index' http://www.tldp.org/HOWTO/HOWTO-INDEX/index.html
'HowtoForge' http://howtoforge.com/
****

--
users mailing list
users@lists.fedoraproject.org
To unsubscribe or change subscription options:
https://admin.fedoraproject.org/mailman/listinfo/users
Guidelines: http://fedoraproject.org/wiki/Mailing_list_guidelines


All times are GMT. The time now is 04:05 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.