Search code examples
regexbashls

regular expression of numbers in ls in linux


I have several files like aa_1.txt,aa_6.txt,aa_9801234123.txt,aa_90.txt I tried to use

ll aa_[0-9]+.txt

to list them and order them as aa_1.txt,aa_6.txt,,aa_90.txt,aa_9801234123.txt. But it does not work.


Solution

  • Pipe ll through egrep:

    ll | egrep "aa_[0-9]+.txt"