ls for *.part1.rar and *.part01.rar


Recommended Posts

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

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

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

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.