using awk with column value conditions

前端 未结 6 507
甜味超标
甜味超标 2020-11-29 18:10

I\'m learning awk from The AWK Programming Language and I have a problem with one of the examples.

If I wanted to print $3 if $2 is equal to a value (e.g.1

6条回答
  •  旧时难觅i
    2020-11-29 18:58

    If you're looking for a particular string, put quotes around it:

    awk '$1 == "findtext" {print $3}'
    

    Otherwise, awk will assume it's a variable name.

提交回复
热议问题