I have large list of data like so
FILE1 (4600 rows)
Genome Gene Boolean
E15-12 VFG000923 1
E15-13 VFG000924 1
E15-14 VFG000926 1
E15-15 VFG000928 1
E15-16 VFG000930 1
E15-17 VFG000932 1
E15-18 VFG000933 0
E15-19 VFG001448 0
E15-24 VFG013465 1
I want to sub the info in col2 to look like:
FILE2 (180rows)
VFG000923|fepA
VFG000924|fepB
VFG000926|fepD
VFG000928|fepG
VFG000930|entF
VFG000932|entE
VFG000933|entB
VFG001448|kpsD
VFG001450|kpsM
VFG044165|entS
Out
Genome Gene Boolean
E15-12 VFG000923|fepA 1
E15-13 VFG000924|fepB 1
E15-14 VFG000926|fepD 1
E15-15 VFG000928|fepG 1
E15-16 VFG000930|entF 1
E15-17 VFG000932|entE 1
E15-18 VFG000933|entB 0
E15-19 VFG001448|kpsD 0
E15-20 VFG001450|kpsM 1
Using code by @val0x00ff (see comments)
Genome Gene Boolean
E15-14 VFG000923|fepA 1
E15-14 VFG000924|fepB 0
E15-14 VFG000926|fepD 1
E15-14 VFG000928|fepG 0
Is there a way to do this with sed or awk?
col1
offile2
coming fromcol2
offile1
, where iscol2
offile2
coming from? Whynumber of rows
less infile2
, – Utsav May 03 '17 at 11:11file1
are present infile2
! – terdon May 03 '17 at 11:55paste FILE1 <(sed '1i\\' FILE2) |awk 'NR>1{$2=$NF;$NF=""}1'
– Valentin Bajrami May 03 '17 at 14:07