Display exact matches only with grep

前端 未结 8 942
半阙折子戏
半阙折子戏 2020-12-09 16:26

How can I display all jobs that ended OK only?

When I try the command below, it shows both OK and NOTOK since both have \"OK\"

ctmpsm -listall applic         


        
8条回答
  •  抹茶落季
    2020-12-09 16:44

    ^ marks the beginning of the line and $ marks the end of the line. This will return exact matches of "OK" only.

    (This also works with double quotes if that's your preference.)

    grep '^OK$'
    

提交回复
热议问题