Insert colon between 2 columns and print other columns

Hi all,

Here is my data structure.

rs123456   1    78910 ABCD 12838

I want to add a colon between columns 2 and 3 and make it the first column so it will look like this.

1:78910  1    78910 rs123456  ABCD 12838

I am using the following code, but I am getting an error message. Can someone help me?

awk '{print "$2":$3", $1, $2,$3,$4,}' file 1.txt > file2.txt
awk: cmd. line:1: {print "$2":$3", $1,$2,$3,$4,$5}
awk: cmd. line:1:            ^ syntax error
awk: cmd. line:1: {print "$2":$3", $1, $2,$3,$4,$5}
awk: cmd. line:1:               ^ unterminated string

Do

awk '{print $2":"$3, $1, $2,$3,$4,}' file 1.txt

Thank you!

Please get accustomed to marking the thread as solved when appropriate and showing your gratitude to the posters (if/when appropriate as well).

Absolutely no problem.

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.