Hi All,
I have a file with more than 2000 columns and I would like to print each column 3 times, so that I will get a file like col1 col1 col1 col2 col2 col2 ........coln coln coln.
I have tried the following code:
awk '{for(i=1; i<=NF; i++) {s=s FS $i,$i,$i} print s;s=""}' input > output
But it didn't work. If anyone can help me in this regard.
Your answers are highly appreciated.
Regards
Fredrick.
---------- Post updated at 06:09 PM ---------- Previous update was at 05:58 PM ----------
Sorry, I got the idea. Here is the code
awk '{for(i=1; i<=NF; i++) {s=s FS $i FS $i FS $i} print s;s=""}' input > output
If someone can help me with some better code, you are always welcome.
Thanks & regards
Fredrick.