AWK/SED. How to remove parentheses in simple text file

后端 未结 6 2129
无人共我
无人共我 2021-02-07 11:14

I have a text file looking like this:

(-9.1744438E-02,7.6282293E-02) (-9.1744438E-02,7.6282293E-02)  ... and so on.

I would like to modify th

6条回答
  •  忘了有多久
    2021-02-07 11:52

    This would work -

    awk -v FS="[()]" '{for (i=2;i<=NF;i+=2) print $i }' inputfile > outputfile
    

    Test:

    [jaypal:~/Temp] cat file
    (-9.1744438E-02,7.6282293E-02) (-9.1744438E-02,7.6282293E-02)
    
    [jaypal:~/Temp] awk -v FS="[()]" '{for (i=2;i<=NF;i+=2) print $i }' file
    -9.1744438E-02,7.6282293E-02
    -9.1744438E-02,7.6282293E-02
    

提交回复
热议问题