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.
我需要 shell 命令来执行以下操作:
输入:
"M ABC/PQR/src/MyFile.h"
输出:
"ABC/PQR/src/MyFile.h"
如果您只想打印第二个文本块,这将起作用:
echo "\"M ABC/PQR/src/MyFile.h\"" | awk '{print $2}'
为了挑战我们使用sed选项,这也将起作用:
sed
echo "\"M ABC/PQR/src/MyFile.h\"" | sed 's/M[ ]*//'
我看到@Fredrik Pihl 的评论指出"应该保留引号。在这种情况下,第二个版本将起作用。
"