Please help with this.
I have several excel files (with and .xlsx format) with 10-15 columns each.
They all have the same type of data but the columns are not ordered in the same way.
Here is a 3 column example. What I want to do add the alphabet
from column 2 to column 3, provided they both have the keyword 'BAM'
in them. Also the prefix 12 needs to be removed (if it is present before BAM).
Also the second column may have a space between BAM and 2A, that space needs to be ignored. So BAM2A is the same as BAM 2A, similarly if space is present in 3rd col, that has to be removed in the output.
So 12BAM2 -1 becomes BAM2A-1.
The last row remains unchanged because both column dont have BAM.
excel can so easily export and import tab-separated data that there's little point installing 19,000 perl modules and writing 3,000 lines of code just to write excel files.
Excel files are more complicated in several ways, too. You have to start worrying about multiple worksheets for instance, formulas, merged columns, and all of that. And the .xlsx files are particularly obnoxious.
I will try to run the code now with exported text, but naively looking at the code, it doesn't consider the keyword 'BAM' to be matched for both columns, is there another way that is being matched?
I wrote it in a generic way so that other keywords will also be matched. Try running for a set of data and verify if you are getting the desired output. Just make sure you preserve the tab spaces since the code is using it as field separator.
One of my actual input files has col 2 as col 8, and col 3 as col 7.
I can replace $2 by $8, what should i replace $4 with ? there is no mention of col3 in the code.
Sorry for the naive question :-/