I have file 1 with 15 columns, I want to change the formatting of the numbers of columns 10,11 and 12 in the scientific notation.
I used the Following script:
I'm pretty sure that what you want can be done, but I don't really understand what you want. Do want to keep the 15 fields, but change fileds' 10, 11, and 12 formatting? And, reflect that back into the original file?
A representative sample would help people in here help you...
BTW, the problem in your second code sample is that you supply only one single format string for three values - supply three!
And, you can't modify the file in place (even the editors that claim doing so work on temporary file overwriting the original with the result). You have to redirect the result to another file, and then mv / cp it back to file1 .
Thanks also to RudiC, but there is a problem. Indeed, not all numbers get their formatting changed to the scientific notation, especially in the column 12. With your code the input is: