sed输出指定两行 # 输出正则匹配的两行,之间的行,包括正则匹配到的行 root@bwhhkle:~# cat tmp 1 2 3 4 5 6 root@bwhhkle:~# sed -n '/2/,/5/p' tmp 2 3 4 5 # 不包括正则匹配的行 root@bwhhkle:~# sed -n '/2/,/5/{//!p}' tmp 3 4 # 只输出正则匹配到的两行 root@bwhhkle:~# sed -n '/2/,/5/{//p}' tmp 2 5 Tags: sed详解 Read more articles Previous Postsed行寻址范围 Next Postsed正则 You Might Also Like bmSTG更新脚本 May 3, 2019 grep正则零宽断言二 January 7, 2016 nginx添加ddns访问 June 18, 2022