如果终端打印(回声)一串字符串如:
aPath aSecondPath aThirdPath
我如何过滤这些并找到ThirdPath例如?
ThirdPath
使用GNU grep:
grep
printf '%s\n' aPath aSecondPath aThirdPath | grep -o ThirdPath
省略-o打印整行“aThirdPath”。
-o