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.
我正在阅读有关删除特定行的问题,但是从特定行到文件末尾如何?
我的猜测(虽然错误):
sed -e '2d-$d' foo
虽然这删除了第二行和最后一行:
sed -e '2d;$d' foo
正确的表达是
sed -e '2,$d' foo
即对于从第 2 行到最后一行的所有行,删除。