0

I have been trying to use regex with find command in bash. Following are my codes:

find . -regextype posix-extended -regex 'AB[0-9]{1}_all_chr\.gz'

However, above code did not match to desired file with id such as "AB1_all_chr.gz" and "AB2_all_chr.gz". can someone help me out with this piece of code?

Maulik Upadhyay
  • 127
  • 1
  • 12

1 Answers1

0

So, to provide an actual answer:

find . -regextype posix-extended -regex '^.*AB[0-9]_all_chr\.gz$'

Match any text at the beginning followed by AB and then any one digit and then ending with _all_chr.gz

John Weldon
  • 39,849
  • 11
  • 94
  • 127