Copying first column to be second column

Hi guys,

Does anyone know how to copy the first column and paste it as the second column in a file? :confused:

For example:

Input:

A  1  3
B  3  7
C  5  2
D  9  4

Output:

A  A  1  3
B  B  3  7
C  C  5  2
D  D  9  4

Thank you very much!!

Try:

awk '{$1=$1" "$1}1' file

Thank you very much!! :slight_smile:

$ awk '$2=$1" "$2' a.txt
A A 1 3
B B 3 7
C C 5 2
D D 9 4

try also:

sed 's/\([^ ]*\).*/\1 &/' input
awk '{print $1,$0}' input