当前位置: 技术问答>linux和unix
AWK 的域 输出对不齐 另命令行怎么输出TAB
来源: 互联网 发布时间:2016-08-25
本文导语: #!/bin/awk -f BEGIN{ OFS="t" ; print "name" "tt","bytes","blocksn" print "================================" } {print $2,"tt",$1*$512,$1} --------------------------------------------------------------------------------------- [root@localhost ~]# du |./duawk.awk -----------...
#!/bin/awk -f
BEGIN{
OFS="t" ;
print "name" "tt","bytes","blocksn"
print "================================"
}
{print $2,"tt",$1*$512,$1}
---------------------------------------------------------------------------------------
[root@localhost ~]# du |./duawk.awk
---------------------------------------------------------------------------------------
./.gstreamer-0.10 0 192
./.Trash 0 4
./.gnome/gnome-vfs 0 8
./.gnome 0 12
./.eggcups 0 4
./.gnome2/nautilus-scripts 0 4
./.gnome2/keyrings 0 4
./.gnome2/accels 0 4
./.gnome2/share/fonts 0 8
./.gnome2/share/cursor-fonts 0 8
./.gnome2/share 0 20
./.gnome2 0 40
./.nautilus/metafiles 0 8
./.nautilus 0 16
. 0 2600
-------------------------------------------------------------------------------------
BEGIN{
OFS="t" ;
print "name" "tt","bytes","blocksn"
print "================================"
}
{print $2,"tt",$1*$512,$1}
---------------------------------------------------------------------------------------
[root@localhost ~]# du |./duawk.awk
---------------------------------------------------------------------------------------
./.gstreamer-0.10 0 192
./.Trash 0 4
./.gnome/gnome-vfs 0 8
./.gnome 0 12
./.eggcups 0 4
./.gnome2/nautilus-scripts 0 4
./.gnome2/keyrings 0 4
./.gnome2/accels 0 4
./.gnome2/share/fonts 0 8
./.gnome2/share/cursor-fonts 0 8
./.gnome2/share 0 20
./.gnome2 0 40
./.nautilus/metafiles 0 8
./.nautilus 0 16
. 0 2600
-------------------------------------------------------------------------------------
|
要对齐好办 用column命令
du |./duawk.awk | column -t
命令行输出tab
echo -e "t"
du |./duawk.awk | column -t
命令行输出tab
echo -e "t"