如何将重定向命令本身包含到输出文件重定向中?例如
echo "hello!">output.txt
Run Code Online (Sandbox Code Playgroud)
我想要这样的输出文件的内容:
echo "hello!">output.txt
hello!
Run Code Online (Sandbox Code Playgroud) 我有a.txt其内容的文件
1 (C##2)
2 (C##U)
Run Code Online (Sandbox Code Playgroud)
并使用grep它
cat a.txt | grep '##[A-Z]*'
1 (C##2)
2 (C##U)
Run Code Online (Sandbox Code Playgroud)
为什么1 (C##2)这个 grep 结果中会出现数字?我只想出现第二个。所以我指定了[A-Z]. 为什么它被..##2视为比赛?