Linux Base: seq Command Summary

This article only summarizes some common usage, a more detailed description see the man seq and seq --help .

seq command

seq command output digital sequence.

Syntax

Usage: seq [OPTION]... LAST
  or:  seq [OPTION]... FIRST LAST
  or:  seq [OPTION]... FIRST INCREMENT LAST

options

parameter Explanation
-f Use printf style floating-point format
-s Delimiter specified, default \ n
-w Filled with 0 on the left reaches the maximum width of the digital

Examples

Positive integers less than 10 print

[root@test ~]# seq 10
1
2
3
4
5
6
7
8
9
10

Print all integer of 1 to 5, with the separator '_' represents

[root@test ~]# seq -s '_' 1 5
1_2_3_4_5

Print ...... 2 decimal places in accordance with 1.1, 1.2, set a median of 5

# %后面指定数字的位数,默认是%g,%5g那么数字位数不足部分是空格
[root@test ~]# seq -f '%5g' 1.1 0.2 2
  1.1
  1.3
  1.5
  1.7
  1.9

Guess you like

Origin www.cnblogs.com/Rohn/p/11073819.html