I have 6 files of similar format but different name. (for example, file_AA.dat file_AB.dat file_AC.dat file_BA.dat file_BB.dat file_BC.dat)
Can I write a for-loop script to read, analyze, and print out those files at once, instead of operating script 6 times? Such as,
for i in {AA AB AC BA BB BC}
filename = 'file_$i.dat'
file = open (filename, 'r')
Do a lot, lot of analysis for lots of rows and columns :P
file open('output_file_$i.dat','w')
Do some for loop for writing and calculation
file.close
So, I hope to automate the process of reading / analyzing / writing the different files (but similar format) at once. I'm curious about how could I handle its naming of input/output part. This way, I wish I could analyze numerous number of files more quickly and easily.
Or, is there any way to do the same using the mix of python and Cshell or shell script?
Thank you