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 grep,sed,awk,perl等对正则表达式的支持的差别 January 25, 2017 awk数组awk详解 January 16, 2015 bm从远端同步cdn域名到本地 October 17, 2019