Bash – Using multiple wildcards in one glob

bashcommand linewildcards

In my directory, I have a list of files with different extensions such as

file-abc-12.out
file-abc-12.csv
file-abc-12.txt
file-xyz-12.out
file-xyz-12.csv
file-xyz-12.txt
file-abc-04.out
file-abc-04.csv
file-abc-04.txt
file-xyz-04.out
file-xyz-04.csv
file-xyz-04.txt

If I only want to list the files that contain abc and end in a .out, how would I do that. I want to perform a ls or a find using two pattern matching searches *abc* and *out. I only know how to search one or the other at a time, how would I have it search for file names with both conditions?

Best Answer

This will give you what you want:

$ find . -name '*abc*' -o -name '*out'
Related Question