zoukankan      html  css  js  c++  java
  • Linux命令之乐--seq

    用法及参数:
      -f, --format=格式          使用printf 样式的浮点格式,默认是g%
      -s, --separator=字符串      使用指定字符串分隔数字(默认使用: )
      -w, --equal-width         在列前添加0 使得宽度相同

    -f,指定打印格式

    seq默认的格式输出是g%,如果省略了首数,则默认从1开始

    [root@Director test]# seq 3
    1
    2
    3

    指定整型宽度

    [root@Director test]# seq -f %03g 3
    001
    002
    003

    指定浮点数

    [root@Director test]# seq -f %0.3f 3
    1.000
    2.000
    3.000

    -w,使输出数字同宽

    [root@Director test]# seq -w 5
    1
    2
    3
    ...
    [root@Director test]# seq -w 10
    01
    02
    03
    ... [root@Director test]# seq -w 100 001 002
    003
    .....

    -s ,指定分隔符,默认是换行

    [root@Director test]# seq -s " " 0 5
    0 1 2 3 4 5
    [root@Director test]# seq -s , 0 5
    0,1,2,3,4,5
    [root@Director test]# seq -s | 0 5
    0|1|2|3|4|5
    [root@Director ~]# seq -s "+" 10|bc
    55

    seq的逆序输出

  • 相关阅读:
    每天一道Java题[4]
    每天一道Java题[3]
    每天一道Java题[2]
    关于OOCSS架构
    新blog开张!
    [原]C++拾遗
    mark
    今天的情况(也是10月份的总结)
    11月份的总结
    Linux管道编程实例
  • 原文地址:https://www.cnblogs.com/zydev/p/5745095.html
Copyright © 2011-2022 走看看