使用grep来查找由空格分隔的两个's'的单词 [英] Use grep to find the words that have two 's' separated by a space
问题描述
我试图用grep来找出两个单词之间用空格隔开,然后是两个单词或多个单词,然后是包含两个单词的单词。
我已经试过这些命令了。
ls | grep -E's +'| grep \s
ls | grep -E s {2,\}
这两个第一个命令会打印包含1或更多的所有单词,这不是我正在寻找的单词,而是last命令打印所有包含两个's'的单词...
顺便说一句,我也很难找到完全相同的输出grep -c,没有-c参数...
例如 ls -R | grep s
大约打印14k,我想找到相同的结果,不需要-c
提前致谢
grepss
greps。* s
grep -E ^ [^ s] * s [^ s] * s [^ s] * $
I'm trying to use grep to find the words that have two 's' separated by a space, then two 's' or more in the words, and then the words that contain exactly two 's'.
I already tried these commands
ls|grep -E 's+'
ls|grep -E 's+'|grep \s
ls|grep -E s{2,\}
The two first commands print all the words that contains 1 's' or more, that isn't what I'm looking for, and the last command prints all the words that contain two 's' side by side ...
Btw, I'm also having trouble to find the exact same output of "grep -c", without the "-c" argument ...
For example ls -R| grep s
prints 14k approximately, and I want to find the same result, without -c
Thanks in advance
grep "s s"
grep "s.*s"
grep -E "^[^s]*s[^s]*s[^s]*$"
这篇关于使用grep来查找由空格分隔的两个's'的单词的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!