cat /etc/passwd | awk 'BEGIN {FS=":"} $3 < 10 {print $1 " " $3}'

root     0
bin      1
daemon   2
adm      3
lp       4
sync     5
shutdown         6
halt     7
mail     8
news     9

printf "
%10s %10s " `cat /etc/passwd | awk 'BEGIN {FS=":"} $3 < 10 {print $1 " " $3}'`

          root          0
            bin          1
    daemon          2
          adm          3
              lp          4
          sync          5
 shutdown          6
           halt          7
           mail          8
         news          9

%ns   – n 為數字,s 等於 string 字串
%ni    – n 為數字,i 等於 integer 整數

http://ssorc.tw/?p=490

用 printf 來算數
printf "$((10+3)) "

Related posts 相關文章
find指令,搭配exec與xargs語法參數
More...
top指令
More...
sysctl指令
More...
rarlinux 指令–壓縮分割加密檔案
More...

作者

留言

撰寫回覆或留言

發佈留言必須填寫的電子郵件地址不會公開。