Remove
I am currently trying to delete some files. The files I want to delete contain the number 3 or 2, either both or one of them. How do I delete files containing those numbers? The files are named like so: K-0_0_1_1_1_1_1_0.wav K-0_0_1_1_1_1_1_1.wav K-0_1_0_0_0_0_0_0.wav K-0_1_0_0_0_0_0_1.wav K-0_1_0_0_0_0_1_0.wav K-0_0_0_0_0_0_0_2.wav K-0_0_0_0_0_0_0_3.wav K-0_0_0_0_0_0_1_2.wav In this list the last three files should be deleted. For the current directory, you can use: rm -- *[23]* If you want to restrict it, to match only files where the 2 or 3 must occur between K and .wav: rm K*[23]*.wav If you want to make this safer by forcing rm to ask for confirmation for every file, use the -i interactive flag: rm -i K*[23]*.wav Notes the shell glob * matches any number (including zero) of any characters to the shell [some chars] is a character class - anything inside can match -- is recognised by rm as the end of options. This avoids errors if any filenames begin ...