Summary of Seq commands
Summary of Seq commands
Example 1:
# seq 1 10
The result is 1 23 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)
Also OK
Seq
-fmam Murtel formatting format use printf style floating-pointFORMAT (default:% g)
-s,-- separator=STRING use STRINGto separate numbers (default:\ n)
-W,-- equal-width equalize width by padding with leading zeroes
The-f option specifies the format
# seq-f "% 3G" 911
nine
ten
eleven
The number of digits specified after% defaults to "% g"
"% 3G" then the insufficient number of digits is a space.
In the case of # sed-f "g" 9 / 11, the underdigits are 0.
% set the string before
Seq-f "strg" 9 11
Str009
Str010
Str011
-w specifies that the output digit is the same width and cannot be used with-f
Seq-w-f "strg" 9 11
Seq: format string may not be specified whenprinting equal width strings
Seq-w 98 101
098
099
one hundred
one hundred and one
The output is the same width.
-s specifies that the delimiter defaults to enter
Seq-s ""-f "strg" 9 11
Str009 str010 str011
To specify\ t as the separator
Seq-s "`echo-e"\ t "`" 911
Specify\ n\ nas the separator
Seq-s "`echo-e"\ n\ n "`" 911
19293949596979899910911