Trying to delete files using a list of the headers and a wildcard. The headers for the files are the same but the endings are different. Not sure how to get the wildcard in there.
I was trying to download some SRA files from NCBI and ran into download issues. Files that didn't download correctly created file1.fastq and file1.sra.cache (and so on for file2, file3, etc...) Files that downloaded correctly give me file.fastq and file.sra.cache, so my downloads look like this:
file1.fastq
file1.sra
file2.fastq
file2.sra.cache
file3.fastq
file3.sra.cache
Where file1 is a successful download, but not file2 or file3. I want to delete all files associated with file2 and file3.
I figured out which files didn't download correctly with ls *.sra.cache
. I now have a list of the faulty file headers (e.g., file2, file3, ...; so just the beginning part). How could I feed in the list of filenames and add a wildcard to remove them?
I'd like to make a list of filenames with a wildcard, like
file2*
file3*
and do something like cat list.txt | xargs rm
, but I'm not sure how to get the wildcard in there to work. Unix thinks *
is part of the filename if I put it into the list itself.