shell通过awk、sed向上合并,练习题

版权声明:文章来源:良玉的博客 http://www.uouo123.com/ 转载请注明 https://blog.csdn.net/xiangliangyu2008/article/details/82711039

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"

猜你喜欢

转载自blog.csdn.net/xiangliangyu2008/article/details/82711039
今日推荐