I have a large file like this
AT5G44030,TAACARA,1000,+,200,206
AT5G44030,TAACARA,1000,+,418,424
AT5G44030,TAACARA,1000,+,773,779
AT5G44030,NGATT,1000,+,114,118
AT5G44030,NGATT,1000,+,267,271
....................................
I want to add two columns at the end with subtractions of 5th - 3rd , 6th - 3rd so the final file should look like follows.
AT5G44030,TAACARA,1000,+,200,206,-800,-794
AT5G44030,TAACARA,1000,+,418,424,-582,-576
AT5G44030,TAACARA,1000,+,773,779,-227,-221
AT5G44030,NGATT,1000,+,114,118,-886,-882
AT5G44030,NGATT,1000,+,267,271,-733,-729
.......................................
(note that there are no empty lines in between)
how do i do this using awk or sed ? the file is very large 1M lines.
so I couldn't get a better script to do it using perl
I am new to awk and sed can anyone please help ?
Thank you