文本:
servername:
server ip: 202.106.5.21
mem size: 8GB
hdd size: 73GB
servername:
server ip: 114.106.5.21
mem size: 16GB
hdd size: 73GB
servername:
server ip: 112.80.5.21
mem size: 32GGB
hdd size: 73GB
要求达到这个效果:
servername serverip mensize hddsize
202.106.5.21 8GB 73GB
114.106.5.21 16GB 73GB
112.80.5.21 32GGB 73GB
- awk 'BEGIN{print "servername\tserverip\tmensize\thddsize"}{printf NR%4?$NF"\t":$NF"\n"}' file|column -t
[解析]
规律啊,每4行换行。大家再仔细看看吧。
阅读(874) | 评论(0) | 转发(0) |