I have a text file that contains a list of file paths. I want to loop through each line (file path), manipulate the file and store the manipulated file under a new name.
To do this I would like dynamically name the new file under file_$index so that each new file gets saved and not overwritten. Any ideas how to do this? my current code is:
for j in $(cat access.txt); do bcftools view $j -include 'maf[0]>0.0 & maf[0]<0.005' -output [FILE_NAME] ; done
i do not know how to dynamically change the file name i.e. to be file_$index. This would be equivalent of doing enumerate on a for loop in python. Note I cannot use the existing file path as that will overwrite the existing file which I do not want
In an ideal world i would manipulate the file path ($j) to extract part of the path as a new name. however I am not sure this is possible so file_$index also works.