Display exact matches only with grep

前端 未结 8 941
半阙折子戏
半阙折子戏 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:46

    Try this:

    Alex Misuno@hp4530s ~
    $ cat test.txt
    1 OK
    2 OK
    3 NOTOK
    4 OK
    5 NOTOK
    Alex Misuno@hp4530s ~
    $ cat test.txt | grep ".* OK$"
    1 OK
    2 OK
    4 OK
    

提交回复
热议问题