shell通过awk、sed向上合并,练习题 要求将下图三行合并成一行: 解决: sed: ethtool p2p1| sed -r ':1;N;/\n\s*10+/s/\n\s+/ /g;t1;P;D' awk: ethtool p2p1|awk 'NR>1&&!/100.*baseT\/Full/{print ""}{printf $0""}END{print " "}'|sed "s/ //g" 相关文章: