匹配整个单词

给出一个文件 sample:

hello world
ahello here
hello_there

hello 的正常 grep 返回:

$ grep hello sample 
hello world
ahello here
hello_there

使用 -w 可以选择那些包含构成整个单词的匹配的行:

$ grep -w hello sample 
hello world