使用grep在名为word的文件中找到以s结尾的8个字母

收藏

如标题所示,我需要使用grep在名为word的文件中找到一个以“ s”结尾的8个字母。

回复
  • /^\w{7}s$/i will match any string that consists of 7 word characters and ends in an "s" (8 letters total).

    In bash: cat words.txt | grep -iE ^\\w{7}s$, using -i (case-insensitive) and -E (extended) flags.