Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

I want to print columns 1 and 5 but specifically those which column 1 has a value greater than and equal to 74

Tags:

awk

I'd like to print columns 1 and 5 but the value in column 1 must be equal to and greater than 74. I'd like to apply this to other files I have as well, to which this value, 74, will vary from file to file.

So far I have the following but it is incorrect. How can I fix this?

Below is the code I tried and the input.txt file.

 awk -F, '{ for i = $1; i >= 74 {print $1,$5}}' ACF.dat > BC.2.txt



 1   0.3412817   5.3072978   0.0000000   8.0890431   1.9268838  23.8225972
    2   0.3412817   5.3072978   5.7338527   8.0976512   1.9360364  23.8764110
    3   0.3531165   5.2904975  11.3516179   8.1056818   1.8200629  23.8167906
    4  11.3748076   5.3429283  16.5366231   8.1055821   1.5542077  23.9504803
    5   6.0751817   5.3072978   0.0000000   8.0890692   1.9268838  44.3048215
    6   6.0751817   5.3072978   5.7338527   8.0975018   1.9360364  73.7154511
    7   6.0484618   5.3022635  11.4318004   8.1033343   1.7952287  75.6216619
    8   0.3412817  11.0411978   0.0000000   8.0890117   1.9268838  75.0124625
    9   0.3412817  11.0411978   5.7338527   8.0974824   1.9360364  76.6290516
   10   0.4137926  11.1117477  11.4654512   8.0991418   1.8447152  24.4732826
   11   6.0751817  11.0411978   0.0000000   8.0889878   1.9268838  46.7563313
   12   6.0751817  11.0411978   5.7338527   8.0976251   1.9360364  46.7448324
   13   6.0586222  11.0670692  11.3641122   8.1062938   1.8431981  46.7470868
   14   6.3217394  11.1620111  16.5483767   8.0990847   1.7856418  46.7592360
   15   3.2082317   2.4403478   2.8669263   2.7979955   1.3656803  24.2004191
   16   3.2082317   2.4403478   8.6007790   2.7910728   1.3654166  24.2012964
   17   3.1485074   2.4474693  14.3631625   2.7233308   1.2029293  24.2012572
   18   8.9421317   2.4403478   2.8669263   2.7975771   1.3656803  24.2002956
   19   8.9421317   2.4403478   8.6007790   2.7893515   1.2974526  66.6064066
   20   8.9118911   2.4881800  14.2800819   2.7911216   1.2845148  24.0997246
   21   3.2082317   8.1742478   2.8669263   2.7978126   1.3656803  44.6223171
   22   3.2082317   8.1742478   8.6007790   2.7890546   1.3654166  45.8621951
   23   3.3363844   8.1494430  14.3028485   2.7788148   1.3067683  23.9754768
   24   8.9421317   8.1742478   2.8669263   2.7976249   1.3656803  93.4683758
   25   8.9421317   8.1742478   8.6007790   2.7887084   1.3654166  91.9130452
   26   9.0751467   8.3414713  14.2364806   2.7944768   1.2653524  92.6877858
   27   0.3412817   2.4403478   2.8669263   7.7017441   1.3792211  68.7242924
   28   0.3412817   2.4403478   8.6007790   7.6901116   1.3789599  25.3562841
   29   0.3238507   2.6301170  14.0004092   7.6703757   1.3428362  58.6592327
   30   3.2082317   5.3072978   2.8669263   7.7019320   1.3656803  44.0605858
   31   3.2082317   5.3072978   8.6007790   7.6917026   1.3654166  38.4065779
   32   3.2818321   5.3138689  13.9283416   7.6751636   1.3557508  38.3077000
   33   3.2082317   2.4403478   0.0000000   7.7784064   1.3801873  39.0646129
   34   3.2082317   2.4403478   5.7338527   7.7015953   1.3637197  38.7404702
   35   3.1815118   2.3624700  11.3703593   7.6880934   1.3267598  38.5854290
   36   6.0751817   2.4403478   2.8669263   7.7017551   1.3792211  38.6470782
   37   6.0751817   2.4403478   8.6007790   7.6897187   1.3789599  38.4351316
   38   6.0764776   2.3822864  14.0076224   7.6772618   1.3778927  38.9087709
   39   8.9421317   5.3072978   2.8669263   7.7013026   1.3656803  46.2021207
   40   8.9421317   5.3072978   8.6007790   7.6876091   1.3654166  36.9463071
   41   8.8076259   5.3936504  14.1263183   7.6884703   1.3811553   4.7183447
   42   8.9421317   2.4403478   0.0000000   7.7776724   1.3801873  39.1383614
   43   8.9421317   2.4403478   5.7338527   7.6991656   1.3637197  39.1577778
   44   8.9481638   2.5595900  11.3476571   7.6726823   1.3039726  39.1541410
   45   8.8772125   2.5905531  16.9805893   7.6702737   1.3397940  39.1378893
   46   0.3412817   8.1742478   2.8669263   7.7018738   1.3792211  37.2595733
   47   0.3412817   8.1742478   8.6007790   7.6897279   1.3789599  34.4898118
   48   0.4169692   7.9929649  14.0273621   7.6766314   1.3491734  36.4919445
   49   3.2082317  11.0411978   2.8669263   7.7018681   1.3656803  93.6083176
   50   3.2082317  11.0411978   8.6007790   7.6907564   1.3654166  36.3954673
   51   3.3539301  11.0334685  14.2004146   7.6794240   1.3686090  39.4717200
   52   3.2082317   8.1742478   0.0000000   7.7774892   1.3801873  79.0382745
   53   3.2082317   8.1742478   5.7338527   7.7012125   1.3637197  39.1626949
   54   3.2432315   8.2726874  11.3863314   7.6820708   1.3428956  39.1673605
   55   3.9990856   7.8424729  17.0254786   7.6926006   1.3245514  39.1620060
   56   6.0751817   8.1742478   2.8669263   7.7018890   1.3792211  39.1677616
   57   6.0751817   8.1742478   8.6007790   7.6897234   1.3789599  39.1659605
   58   6.1763507   8.2793617  14.0011177   7.6839230   1.3749699  39.1658491
   59   8.9421317  11.0411978   2.8669263   7.7012575   1.3656803  39.1673681
   60   8.9421317  11.0411978   8.6007790   7.6877341   1.3654166  39.1671774
   61   8.9148728  11.1256238  13.8862860   7.6597861   1.3256525  37.0687737
   62   8.9421317   8.1742478   0.0000000   7.7777396   1.3801873  42.3913390
   63   8.9421317   8.1742478   5.7338527   7.6992121   1.3637197  87.5013817
   64   8.9429230   8.1200740  11.3467554   7.6683268   1.3031305  35.3952411
   65   9.1297105   8.6004945  16.9267157   7.6724146   1.2861274  41.1055623
   66   5.8861350   4.8470377  16.6377367   0.4482235   0.1666497  37.3038988
   67   7.6880246   4.8940327  18.1238176   0.8895025   0.2168563  19.1016161
   68   6.4031379   6.0438173  18.6139291   0.9333891   0.2796700  24.4626324
   69   7.9045367   6.6756931  17.8570901   0.8786283   0.2784306  11.6537721
   70   7.2484065   5.5304727  15.7963681   0.5302937   0.1519229  33.8507502
   71   5.9938750   6.5290658  16.3092784   0.5224172   0.1276730  12.5682107
   72   3.3430931   5.8333717  17.2457067   0.3579196   0.1097612  14.7772461
   73   2.1929989   3.0491848  19.4660853   0.9417009   0.3173905   9.9404940
   74   3.8442474   2.4229741  19.6368515   0.9730546   0.2603261  11.6143866
   75   3.0400794   5.3966320  19.8297080   0.9877277   0.2689375  14.1817891
   76   4.6883004   4.7970495  19.9764195   0.9736693   0.3181407  11.5847452
   77   4.1136375   3.5903503  22.0690857   1.0263946   0.2813410  11.3046169
   78   2.4089605   4.0161268  21.8858896   0.9888557   0.2550191  18.4337507
   79   2.9669148   6.4459930  22.0567846   0.9764350   0.2351261  23.0727436
   80   4.6813280   6.0670855  22.1902289   0.9911117   0.2690021  11.3412712
   81   2.5378929   5.1550857  24.1968197   0.9934302   0.2725026  35.4206380
   82   4.2698977   4.8472326  24.3372195   1.0127649   0.2668865  24.6912424
   83   2.9552635   7.6280136  24.3113937   1.0154646   0.2806452  43.1118453
   84   4.6910527   7.3403324  24.4223611   0.9770982   0.2695894  38.0004699
   85   2.6080415   6.3589639  26.4581268   0.9986311   0.3172663  33.3720395
   86   4.3441173   6.0742872  26.5697382   1.0150465   0.2627896  34.4538119
   87   2.9984513   8.8562150  26.6023908   0.9910427   0.2650921  31.2034611
   88   4.7471990   8.5746346  26.7076263   0.9809014   0.2645435   3.2665867
   89   3.6781478   8.0200633  28.0175956   0.9723493   0.3402254  13.6689551
   90   7.1930858   5.8422019  17.8811771   3.8658485   0.4683371  28.3613794
   91   3.2571878   3.3067172  19.3394356   4.5066608   0.5998572  15.4942387
   92   3.6349142   4.5350906  20.1763282   4.0044206   0.5888338  30.5987202
   93   3.4352139   4.3730850  21.6835657   3.9788272   0.5640205  34.2752838
   94   3.6734230   5.6847834  22.4350914   4.0287886   0.5693217  33.6754044
   95   3.5317269   5.5746352  23.9529555   4.0017847   0.5700911  43.0298856
   96   3.7076315   6.9073082  24.6817144   3.9986791   0.5331233  34.0453418
   97   3.5906829   6.7945224  26.2029275   3.9837305   0.5883212   3.3751969
   98   3.7620233   8.1307275  26.9251817   4.0720758   0.5837078  16.0209102
   99   6.5520702   5.6907696  16.5496326   6.1538896   0.6838704  37.0404848
  100   3.5710156   3.5955108  17.5679179   1.7002060   0.5045568  30.0762459
  101   5.0534007   3.7155901  17.3197387   7.4766650   0.8247667  16.0888164
  102   2.7966409   5.0004883  17.3023175   7.4347641   0.7297818   2.1366604
  103   2.8232003   2.5504158  16.7358234   7.4131846   0.7926074   2.0459209 
like image 659
Courtney Brea Avatar asked Oct 23 '25 14:10

Courtney Brea


1 Answers

You could do something like as follows.

awk '$1>=74{print $1,$5}' Input_file

OR

awk -v val="74" '$1>=val{print $1,$5}' Input_file
like image 192
RavinderSingh13 Avatar answered Oct 27 '25 04:10

RavinderSingh13



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!