SEQ command usage in Linux

Source: Internet
Author: User
Used to generate all integers between one number and the other.
Example 1:
# Seq 1 10
The result is 1 2 3 4 5 6 7 8 9 10.
Example 2:
#! /Bin/bash
For I in 'seq 1 10 ';
Do
Echo $ I;
Done
Or use
For I in $ (SEQ 1 10)
Yes. Seq
-F, -- format = format use printf style floating-point format (default: % G)
-S, -- separator = string use string to separate numbers (default:/N)
-W, -- equal-width equalize width by padding with leading zeroes

 

-FOption format
# Seq-F "% 3G" 9 11
9
10
11
% The default number of digits after the specified number is "% G ",
"% 3G", less than a digit is a space
# Sed-F "% 03G" 9 11. If this is the case, less than 0 digits are allowed.
% String
SEQ-F "str % 03G" 9 11
Str009
Str010
Str011

 

-WThe specified output number and width cannot be used together with-f.
SEQ-w-F "str % 03G" 9 11
SEQ: Format String may not be specified when printing equal width strings
SEQ-W 98, 101
098
099
100
101
The output is of the same width.

 

-SThe default Delimiter is carriage return.
SEQ-s ""-F "str % 03G" 9 11
Str009 str010 str011
Specify/T as the Separator
SEQ-s "'echo-e"/t "'" 9 11

 

Specify/n as the Separator
SEQ-s "'echo-e"/n "'" 9 11
19293949596979899910911
An error is returned.
However, this is not necessary. The default carriage return is used as the separator.

 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.