Display exact matches only with GREP
问题 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 application | grep OK 回答1: You need a more specific expression. Try grep " OK$" or grep "[0-9]* OK" . You want to choose a pattern that matches what you want, but won't match what you don't want. That pattern will depend upon what your whole file contents might look like. You can also do: grep -w "OK" which will only match a whole word "OK", such as "1