That's because print always prints an entire line including the RS char, usually <LF> (\n, 0x0A). Did you consider using the "print formatted" printf command? And, for your desired result, you need to output field 1, and then every other field starting from field 2.
Please be aware that your input file has DOS line terminators (<CR>, \r, ^M, 0x0D), so the result you see will not be exactly what you want. Either create a correct *nix text file with your application / editor, or remove the <CR> when processing the file.
Could you please try following and let me know if this helps you. This should remove if any carriage characters there and will provide the output as TAB delimited too.
I have 12k columns and 200k rows. I am running this script using 60GB memory but it was failing. Is it it possible to run this more memory efficient? thanks @RavinderSingh13
Hard to believe that it uses 60 GB of memory, it's really a plenty of it?
Since I don't have that much size of Input_file so solution will be on assumption or a try only. In my previous solution I have put 1 condition which will check if variable i's value is equal to value of NF(Number of fields) or not, which was off course to NOT to have a TAB at last of line, since we are talking in terms of performance here then you could try to remove than condition and let me know, if you are ok with a TAB at last of line then let it be same code.
If you want to remove TAB at last of each line then you could add | awk '{sub(/[[:space:]]+$/,"");print}' after Input_file in above code I think that should be more faster than checking conditions in each fields etc. Kindly try it out and let me know how it goes then.