说我有以下file.txt
some line
{
hey it's me, another line
}
# START FOO
These lines
need to be commented
out
# END FOO
Some other line
如何注释掉# START FOO
中标记# END FOO
和bash
之间的所有行?一口气可以做到吗?
答案 0 :(得分:4)
尝试一下:
sed '/START FOO/,/END FOO/s/^/#/' file.txt