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.
如何打印以某个字符串开头的单词?例如,以do.
do
我的文本文件:
domino doleto defrad domes depo dewalk dorio
输出:
domino doleto domes dorio
谢谢
以 ^ 开始搜索字符串,例如 "^do"
尝试:
grep '^do' file
字符 ^ 表示该行必须以 do 开头。