如何在Linux中模拟旧的unix grep -S严格的function

我正在刷新一个命令的输出,我只想返回特定的,严格的结果。

我记得grep的一些迭代有一个严格的选项-s / --strict

例如, grep -s bytes只会返回提及单词“bytes”的条目,而不是每个包含字节的单词,如“兆字节”,“千字节”等。

  -w, --word-regexp Select only those lines containing matches that form whole words. The test is that the matching substring must either be at the beginning of the line, or preceded by a non-word constituent character. Similarly, it must be either at the end of the line or followed by a non-word con- stituent character. Word-constituent characters are letters, digits, and the underscore.