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?
ls *abc*.out?printf '%s\n' *abc*.outlsorfind".printfhere, why? The OP hasn't suggested they want to parse the output, only list the names. Why wouldprintfbe useful here?