Display exact matches only with grep

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

    This worked for me:

    grep  "\bsearch_word\b"  text_file > output.txt  ## \b indicates boundaries. This is much faster.
    

    or,

    grep -w "search_word" text_file > output.txt
    

提交回复
热议问题