01. Command Overview The seq command is used to generate a sequence of integers. 02. Command format usage: seq [options]... tailseq [options]... first number tailseq [options]... first number increment tailseq [options]... 03. Common options Prints numbers starting from the first digit to the last digit in the specified increment. -f, --format=FORMAT Use printf-style floating point format -s, --separator=STRING Use the specified string to separate numbers (default: \n) -w, --equal-width Add 0 in front of columns to make them equal width --help Display this help message and exit --version Display version information and exit 04. Reference examples 4.1 Output 1-5 [deng@localhost ~]$ seq 5 1 2 3 4 5 [deng@localhost ~]$ 4.2 Output 1-5 [deng@localhost ~]$ seq 1 5 1 2 3 4 5 [deng@localhost ~]$ 4.3 Output 3-5 [deng@localhost ~]$ seq 3 5 3 4 5 [deng@localhost ~]$ 4.4 Output 1 4 7 10 [deng@localhost ~]$ seq 1 3 10 1 4 7 10 [deng@localhost ~]$ 4.5 Specifying the output format [deng@localhost ~]$ seq -f "%3g" 9 11 9 10 11 [deng@localhost ~]$ It means -f specifies the format, % specifies 3 digits after it, the default is %g, and spaces are used to fill in the places where %3g does not have enough digits 4.6 Specifying output format [deng@localhost ~]$ seq -f "%03g" 9 11 009 010 011 [deng@localhost ~]$ This means printing three digits and filling the missing digits with 0. 4.7 Specifying the output format [deng@localhost ~]$ seq -f "str%03g" 9 11 str009 str010 str011 [deng@localhost ~]$ It means to print three missing digits with 0 and add str in front. 4.8 Add 0 in front of columns to make them have the same width [deng@localhost ~]$ seq -w 9 11 09 10 11 [deng@localhost ~]$ When outputting a fixed-width string, the format string should not be specified. -w and -f cannot be used together. 4.9 Use the specified string to separate numbers [deng@localhost ~]$ seq -s " " -f "str%03g" 9 11 str009 str010 str011 [deng@localhost ~]$ 4.10 Use the tab key to separate numbers [deng@localhost ~]$ seq -s "`echo -e '\t'`" 9 11 9 10 11 [deng@localhost ~]$ First use the command to make a tab, and then specify it as a separator 05. Appendix Reference: 【Linux】A summary of the series of tutorials on learning Linux step by step The above is the full content of this article. I hope it will be helpful for everyone’s study. I also hope that everyone will support 123WORDPRESS.COM. You may also be interested in:
|
<<: Django2.* + Mysql5.7 development environment integration tutorial diagram
>>: Vue realizes the whole process of slider drag verification function
According to null-values, the value of null in My...
Table of contents 1. Demand Background 2. Optimiz...
Ordered List XML/HTML CodeCopy content to clipboa...
Today, I will answer these newbie questions: Build...
1. Use CSS Copy code The code is as follows: style...
What is a big deal? Transactions that run for a l...
1. Dynamically create objects There are two ways ...
Preface The project has requirements for charts, ...
This article shares the specific code of js to ac...
Table of contents Preface Mysql case when syntax:...
If you’re looking for inspiration for columnar web...
Table of contents 1. Data Type 1.1 Why do we need...
Nginx does not support nested if statements, nor ...
When receiving this requirement, Baidu found many...
The first step is to download the free installati...