awk OR statement

后端 未结 3 1746
闹比i
闹比i 2021-02-02 06:32

Does awk have an OR statement i.e given the following snippet:

awk \'{if ($2==\"abc\") print \"blah\"}\'

Is it possible t

3条回答
  •  梦如初夏
    2021-02-02 06:55

    Yes. There's logical OR || that you can use:

    awk '{if ($2=="abc" || $2=="def") print "blah" }'
    

提交回复
热议问题