-Alex- Posted February 14, 2009 Share Posted February 14, 2009 Hi all, At the moment I have a shell script that asks the user for a string such as blah* - the script then lists blah*.part1.rar - the only problem is that it doesn't list blah*.part01.rar. How can I get it to list both? I currently have ls blah*.part1.rar which will list .part1.rar - at the same time ls blah*.part[0]1.rar will list .part01.rar - but not both. Any help would be appreciated! Preferably, it'd be a serious help if just ls was used, as opposed to piping it to another program. Thanks! Link to comment Share on other sites More sharing options...
I8PP Posted February 14, 2009 Share Posted February 14, 2009 how about ls blah*.part[0-9][0-9].rar Link to comment Share on other sites More sharing options...
-Alex- Posted February 14, 2009 Author Share Posted February 14, 2009 No, that wouldn't work because it would match .part92.rar for example - I only need to match .part1.rar and .part01.rar Link to comment Share on other sites More sharing options...
rson451 Posted February 18, 2009 Share Posted February 18, 2009 ls blah*.part{1,01}.rar Link to comment Share on other sites More sharing options...
-Alex- Posted February 19, 2009 Author Share Posted February 19, 2009 Fantastic! I don't suppose there is a way to match part1, 01, 001, 0001, 00001 etc? Link to comment Share on other sites More sharing options...
ToneKnee Posted February 21, 2009 Share Posted February 21, 2009 Fantastic! I don't suppose there is a way to match part1, 01, 001, 0001, 00001 etc? By looking at rson451's suggestion and a slight modification, would does this help? ls blah*.part{1,01,001,0001,00001}.rar Link to comment Share on other sites More sharing options...
rson451 Posted February 22, 2009 Share Posted February 22, 2009 I think he means with any number of zeros. AFAIK that is not possible because bash's wildcards aren't a full regular expression implementation. Link to comment Share on other sites More sharing options...
-Alex- Posted February 24, 2009 Author Share Posted February 24, 2009 I think he means with any number of zeros. AFAIK that is not possible because bash's wildcards aren't a full regular expression implementation. Yes, that is what I meant. No problem though, that'll do me fine. Thanks all :) Link to comment Share on other sites More sharing options...
Recommended Posts