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
Two cases: 1. With index 2. Without index Prerequ...
Cooper talked about the user's visual path, w...
Table of contents A murder caused by ERR 1067 The...
Table of contents Parsing .vue files Extract docu...
Recently, I used vuethink in my project, which in...
HTML forms are used to collect different types of...
1. Install MySQL database ① Download and unzip an...
Table of contents The dynamic particle effects ar...
Table of contents Preface Create a bridge network...
This question originated from a message on Nugget...
Table of contents 1. Development Environment 2. I...
I am a beginner in SQL and thought that the insta...
Preface This article introduces how to use the ne...
Use the Vue-Cropper component to upload avatars. ...
1. First, you need to use the target selector of ...