Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想使用 grep 在目录 (/bin) 中搜索以特定字符开头的任何内容,然后是包含其他两个特定字符之一的任何字符串。就我而言,我希望每个文件都以“g”开头并包含字母“e”或“n”。我尝试了许多“ls /bin | grep '^g'”的变体。
怎么样:
ls /bin | grep '^g.*[en]'
与find您一起可以:
find
find /bin -regex '/bin/g.*[en].*'