合併圖案行/我需要打印所有行合併行與/ s之前的空白行「^」開始的行。使用awk或sed將是完美的。合併圖案行/
來源:
ext_bus 3 0/1/1/0/1/1 c8xx CLAIMED
/dev/c8xx3
target 4 0/1/1/0/1/1.0 tgt CLAIMED
disk 4 0/1/1 sdisk CLAIMED
/dev/c3t0 /dev/c2t0
/dev/c4t0
要:
ext_bus 3 0/1/1/0/1/1 c8xx CLAIMED /dev/c8xx3
target 4 0/1/1/0/1/1.0 tgt CLAIMED
disk 4 0/1/1 sdisk CLAIMED /dev/c3t0 /dev/c2t0 /dev/c4t0
http://whathaveyoutried.com?你讀過[faq](http://stackoverflow.com/faq)嗎? – 2013-03-21 13:25:37
我試過sed -n'/^[az]/{x; p};/^ [^ az]/{H; x; s/\ n \ s * \([^ az] \)/ \ 1/; x}; $ {x; p}',但它給了我「無法解析」,我認爲它不會做任何好事來發布它:) – Alberto 2013-03-21 13:38:36
它總是**更好地告訴我們你有什麼試過! – 2013-03-21 13:39:39