Hey i need to find file name which has different parts in its name and extension which is is located in the given directory

Example-    part1_part2_part3.h

In this I need to find only part1_part2_part3.h, partx_party_partz.h files which is in correct format. How i have to design If condition?

  • What about ls part*_part*_part*.h? – Mathieu Dec 9 '15 at 12:08
printf '%s\n' *_*_*.h

Would print the filenames that contain at least 2 underscores, don't start with . and end in .h one per line. When there's no such file however, it will print *_*_*.h.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.