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.
当我试图删除连续的重复行时
awk "!x[$0]++" file
它的报告x[: Event not found.
x[: Event not found.
即使是同样的情况
sed -i -e "$!N; /^\(.*\)\n\1$/!P;D" file 以及报告
sed -i -e "$!N; /^\(.*\)\n\1$/!P;D" file
N: Event not found. 我也试过用单引号,它没有帮助
N: Event not found.
任何解决这些问题的想法
您正在调用 shell 的历史替换。用单引号将感叹号括起来。