Linux - seq

1 Overview

  1. Generate command sequences
  2. Before seemingly written seq command, this time pulling out alone write it once
    1. Day parade put off

2. Command

1. Help

  1. command

    
    # 输出我就不打了,
    # 这个命令可用, 证明组件可用
    > seq --help
    

2. Simple Sequence

  1. command

    
    # 输出 [1, 3]
    # 步长为 1
    # seq 3 也可以
    > seq 1 3
    1
    2
    3
    

3. The sequence step

  1. command

    
    # 输出 [1, 5]
    # 步长为 2
    > seq 1 2 5
    1
    3
    5
    

4. The reverse sequence

  1. command

    
    # 输出 [1, 3]
    # 步长为 -1, 导致逆序
    > seq 3 -1 1
    3
    2
    1
    

The fractional step

  1. command

    
    > seq 1 0.5 3
    1.0
    1.5
    2.0
    2.5
    3.0
    

6. custom delimiter

  1. command

    
    > seq -s, 1 3
    1,2,3
    

7. The output width

  1. command

    
    > seq -w 1 10
    01
    02
    03
    04
    05
    06
    07
    08
    09
    10
    

8. Output Formatting

  1. command

    
    > seq -f 'format %g' 1 3
    format 1
    format 2
    format 3
    
  2. other
    1. format
      1. format
        1. Single quotation marks
        2. % G needs to contain similar format placeholder
      2. Placeholder
        1. Placeholder
          1. After running, using numbers generated substitute
        2. kind
          1. a
            1. I'm sorry I can not read
          2. e
            1. Scientific notation
          3. f
            1. Float
          4. g
            1. The default format, I do not know what, but generally you can use this
        3. Other modifications (where they talk about% g)
          1. The integer part of the output width: X
            1. For example:% 2g said output width is 2, is not filled with spaces
            2. If not, the value will still show up
          2. Partially filled integer 0
            1. For example:% 02g represents the output width is 2, 0 is filled with enough
            2. Consignee integer, decimal, if you want to fill 0, need f%
          3. Bit output display .X
            1. For example:% 2.4g said display two integer, two decimals
            2. Feeling a little pit
            3. If the number of decimal places displayed incomplete, you may use the format to display e%
          4. Align Right
            1. The default is right-aligned
            2. For example:% 3g represents an integer of length three, right, supplemented by a space shortage
          5. Left -
            1. For example:% -3g said Left
          6. feel
            1. It was a very troublesome thing,
            2. Also did not say too detailed,
            3. And other deep understanding, and again supplement
        4. By the way, I found two pit
          1. % G placeholders can appear only once, an error will occur twice
            1. Will complain
              1. An error
          2. Under the command line mode of vim ex,% # and need to escape, otherwise it will not
            1. E.g

              
              :r !seq -f '\#\# \%g' 1 3
              

3. Other

  1. First it right today
    1. Not think of anything to expand the
  2. Formatted output this thing, in fact, very good
    1. c, java, py have something like that
    2. I just did not learn
    3. Today, to understand more, later had to supplement
    4. This thing, I really do not know how to speak
      1. To understand, in fact, itself an arduous task
      2. Feeling better a few common examples
      3. But I'm not much use
  3. ref
    1. Linux seq Command Tutorial for Beginners (5 Examples)
    2. Example Uses of the Linux 'Seq' Command
    3. Format conversion specifier% f% e% g What is the difference

Guess you like

Origin www.cnblogs.com/xy14/p/11426487.html