I have a file fith big number of colums like
ASN 1 | R ASN 1 | 0.000 +/- 0.000 | -0.000 +/- 0.000 | 0.045 +/- 0.034 | -0.045 +/- 0.034 | 0.000 +/- 0.000 | 0.000 +/- 0.001 HID 2 | R HID 2 | 0.000 +/- 0.000 | -0.000 +/- 0.000 | 0.001 +/- 0.002 | -0.001 +/- 0.002 | 0.000 +/- 0.000 | 0.000 +/- 0.001 PRO 3 | R PRO 3 | 0.000 +/- 0.000 | -0.000 +/- 0.000 | 0.001 +/- 0.004 | -0.001 +/- 0.004 | 0.000 +/- 0.000 | -0.000 +/- 0.001 LYS 4 | R LYS 4 | 0.000 +/- 0.000 | -0.000 +/- 0.000 | 0.182 +/- 0.073 | -0.176 +/- 0.072 | 0.000 +/- 0.000 | 0.005 +/- 0.003 MET 5 | R MET 5 | 0.000 +/- 0.000 | -0.000 +/- 0.000 | -0.004 +/- 0.004 | 0.006 +/- 0.004 | 0.000 +/- 0.000 | 0.002 +/- 0.001 from this file I need to extract of only first and last column removing from the last column error value (+/- value ) to obtain smth like: ASN 1 0.000
its strange that below command works good with the exemption that it could not remove error from the last column
gawk -F'[|]' '{print $1, $NF}' $file ASN 1 0.000 +/- 0.001 HID 2 -0.000 +/- 0.001 PRO 3 -0.000 +/- 0.001 LYS 4 0.000 +/- 0.001 MET 5 -0.000 +/- 0.001 GLU 6 -0.000 +/- 0.001 MET 7 0.000 +/- 0.001 ILE 8 0.000 +/- 0.001 LEU 9 0.001 +/- 0.001 alternatively when I replace it with
gawk -F'[|,+/-]' '{print $1, $(NF-1)}' $file it didn't replace column before last column (value) but did subtraction -1 from the last (error) column:
ASN 1 -0.999 HID 2 -0.999 PRO 3 -0.999 LYS 4 -0.997 what should I correct here to fix the script ?