0

I have the CSV file like below

MK0280,GCA_000007185.1,AAM01497.1,430,1 430,430,COG0001,COG0001,0,570.0,1.0e-200,432,3-431 
MA_0581,GCA_000007345.1,AAM04025.1,424,1 424,424,COG0001,COG0001,0,574.0,1.0e-200,432,3-426

I want the output like below

MK0280,GCA_000007185.1,AAM01497,430,1 430,430,COG0001,COG0001,0,570.0,1.0e-200,432,3-431 
MA_0581,GCA_000007345.1,AAM04025,424,1 424,424,COG0001,COG0001,0,574.0,1.0e-200,432,3-426 

Want to remove decimal part from column 3. Any sed/awk or other suggestion?

Aven Desta
  • 2,114
  • 12
  • 27
Shaminur
  • 51
  • 6
  • 2
    Try `awk '{gsub(/\.?/,$3)}1' file` – shishi1181 Feb 19 '21 at 08:08
  • 1
    In case some are wondering, the "1" after the braces is explained here: https://stackoverflow.com/questions/24643240/what-does-a-number-do-after-curly-braces – MyICQ Feb 21 '21 at 08:28
  • The code posted by shishi above removes all the `.` characters when I run it, which I don't think it what the OP asked? This worked for me `gawk -F, -vOFS=, 'sub("\\..*","",$3)' file` – cnamejj Feb 27 '21 at 23:52
  • I would even be more specific with the regex by using `'sub("\\.[0-9]+$", "", $3)'`. – Ludovic Kuty Apr 04 '21 at 06:56

0 Answers0