seq

将一系列数字打印到标准输出,用于产生从某个数到另外一个数之间的所有实数

语法

  seq [options]... [FIRST [STEP]] LAST...

选项


 -f FORMAT
 --format=FORMAT
     使用FORMAT打印所有数字; 默认 `%g'.  格式必须包含
     正好是标准浮动输出格式之一: `%e', `%f', `%g'.

 -s STRING
 --separator=STRING
     用指定字符串分隔数字 ; 默认是换行符
 -w
 --equal-width
     在列前添加0 使得宽度相同。(要使用其他类型的填充,请使用`--format')。

`seq’ 通过STEP打印从FIRST到LAST的数字。 默认情况下,FIRST和STEP均为1,每个数字都打印在自己的行上。所有数字都可以是实数,而不仅仅是整数。

例子

生成从1到100的数字序列

$ seq 100

您还可以使用for命令生成序列

for ((myseq=0; myseq<50; myseq++))
do
echo The sequence is ${myseq}
done 
fi

seq 命令实例:

linux命令:seq -s '*' 40 | tr -dc '[*\n]' '[*\n]' -dc tr | 40 '*' -s seq seq -s '*' 40 | tr -dc '[*\n]'rootopen.com
linux命令:seq -s '*' 40 | tr -dc '[*\n]' '[*\n]' -dc tr | 40 '*' -s seq seq -s '*' 40 | tr -dc '[*\n]'rootopen.com
2019-07-09 21:14:06

linux命令:seq 1 9 | perl -MList::Util=shuffle -e 'print shuffle <>;' <>;' shuffle 'print -e -MList::Util=shuffle perl | 9 1 seq seq 1 9 | perl -MList::Util=shuffle -e 'print shuffle <>;'rootopen.com
linux命令:seq 1 9 | perl -MList::Util=shuffle -e 'print shuffle <>;' <>;' shuffle 'print -e -MList::Util=shuffle perl | 9 1 seq seq 1 9 | perl -MList::Util=shuffle -e 'print shuffle <>;'rootopen.com
2019-07-09 21:07:16

linux命令:seq 1 9 | perl -e 'print sort { (-1,1)[rand(2)] } <>' <>' } (-1,1)[rand(2)] { sort 'print -e perl | 9 1 seq seq 1 9 | perl -e 'print sort { (-1,1)[rand(2)] } <>'rootopen.com
linux命令:seq 1 9 | perl -e 'print sort { (-1,1)[rand(2)] } <>' <>' } (-1,1)[rand(2)] { sort 'print -e perl | 9 1 seq seq 1 9 | perl -e 'print sort { (-1,1)[rand(2)] } <>'rootopen.com
2019-07-09 21:06:25

linux命令:seq -s “\\ _ /” 256 | tr -d “0-9” | fold -70 -70 fold | “0-9” -d tr | 256 /” _ “\\ -s seq seq -s “\\ _ /” 256 | tr -d “0-9” | fold -70rootopen.com
linux命令:seq -s “\\ _ /” 256 | tr -d “0-9” | fold -70 -70 fold | “0-9” -d tr | 256 /” _ “\\ -s seq seq -s “\\ _ /” 256 | tr -d “0-9” | fold -70rootopen.com
2018-11-17 12:01:00

linux命令:seq -ws "\\__/" 99|fold -69|tr "0-9" " " " " "0-9" -69|tr 99|fold "\\__/" -ws seq seq -ws "\\__/" 99|fold -69|tr "0-9" " "rootopen.com
linux命令:seq -ws "\\__/" 99|fold -69|tr "0-9" " " " " "0-9" -69|tr 99|fold "\\__/" -ws seq seq -ws "\\__/" 99|fold -69|tr "0-9" " "rootopen.com
2018-11-17 11:59:44

linux命令:seq 12 12 seq seq 12rootopen.com
linux命令:seq 12 12 seq seq 12rootopen.com
2018-11-17 11:54:49

linux命令:seq -f"ftp://ftp.vim.org/pub/vim/patches/7.1/7.1.%03g" 176 240 | xargs -I {} wget -c {}; {}; -c wget {} -I xargs | 240 176 -f"ftp://ftp.vim.org/pub/vim/patches/7.1/7.1.%03g" seq seq -f"ftp://ftp.vim.org/pub/vim/patches/7.1/7.1.%03g" 176 240 | xargs -I {} wget -c {};rootopen.com
linux命令:seq -f"ftp://ftp.vim.org/pub/vim/patches/7.1/7.1.%03g" 176 240 | xargs -I {} wget -c {}; {}; -c wget {} -I xargs | 240 176 -f"ftp://ftp.vim.org/pub/vim/patches/7.1/7.1.%03g" seq seq -f"ftp://ftp.vim.org/pub/vim/patches/7.1/7.1.%03g" 176 240 | xargs -I {} wget -c {};rootopen.com
2018-04-28 04:39:48

linux命令:seq 100 | awk '{sum+=$1} END {print sum}' sum}' {print END '{sum+=$1} awk | 100 seq seq 100 | awk '{sum+=$1} END {print sum}'rootopen.com
linux命令:seq 100 | awk '{sum+=$1} END {print sum}' sum}' {print END '{sum+=$1} awk | 100 seq seq 100 | awk '{sum+=$1} END {print sum}'rootopen.com
2018-05-01 07:48:48

linux命令:seq 50| awk 'BEGIN {a=1; b=1} {print a; c=a+b; a=b; b=c}' b=c}' a=b; c=a+b; a; {print b=1} {a=1; 'BEGIN awk 50| seq seq 50| awk 'BEGIN {a=1; b=1} {print a; c=a+b; a=b; b=c}'rootopen.com
linux命令:seq 50| awk 'BEGIN {a=1; b=1} {print a; c=a+b; a=b; b=c}' b=c}' a=b; c=a+b; a; {print b=1} {a=1; 'BEGIN awk 50| seq seq 50| awk 'BEGIN {a=1; b=1} {print a; c=a+b; a=b; b=c}'rootopen.com
2018-05-29 02:02:48

linux命令:seq 6 | awk '{for(x=1; x<=5; x++) {printf ("%f ", rand())}; printf ("\n")}' ("\n")}' printf rand())}; ", ("%f {printf x++) x<=5; '{for(x=1; awk | 6 seq seq 6 | awk '{for(x=1; x<=5; x++) {printf ("%f ", rand())}; printf ("\n")}'rootopen.com
linux命令:seq 6 | awk '{for(x=1; x<=5; x++) {printf ("%f ", rand())}; printf ("\n")}' ("\n")}' printf rand())}; ", ("%f {printf x++) x<=5; '{for(x=1; awk | 6 seq seq 6 | awk '{for(x=1; x<=5; x++) {printf ("%f ", rand())}; printf ("\n")}'rootopen.com
2018-01-24 05:03:48

linux命令:seq 0 0.1 20 | awk '{print $1, cos(0.5*$1)*sin(5*$1)}' | graph -T X X -T graph | cos(0.5*$1)*sin(5*$1)}' $1, '{print awk | 20 0.1 0 seq seq 0 0.1 20 | awk '{print $1, cos(0.5*$1)*sin(5*$1)}' | graph -T Xrootopen.com
linux命令:seq 0 0.1 20 | awk '{print $1, cos(0.5*$1)*sin(5*$1)}' | graph -T X X -T graph | cos(0.5*$1)*sin(5*$1)}' $1, '{print awk | 20 0.1 0 seq seq 0 0.1 20 | awk '{print $1, cos(0.5*$1)*sin(5*$1)}' | graph -T Xrootopen.com
2018-05-08 10:30:48

linux命令:seq 1 12 | sed 1,5d ; seq 1 12 | head --lines=-5 --lines=-5 head | 12 1 seq ; 1,5d sed | 12 1 seq seq 1 12 | sed 1,5d ; seq 1 12 | head --lines=-5rootopen.com
linux命令:seq 1 12 | sed 1,5d ; seq 1 12 | head --lines=-5 --lines=-5 head | 12 1 seq ; 1,5d sed | 12 1 seq seq 1 12 | sed 1,5d ; seq 1 12 | head --lines=-5rootopen.com
2018-03-07 22:19:48

linux命令:seq -s " " -w 3 20 20 3 -w " " -s seq seq -s " " -w 3 20rootopen.com
linux命令:seq -s " " -w 3 20 20 3 -w " " -s seq seq -s " " -w 3 20rootopen.com
2018-02-10 14:20:48

linux命令:seq 4|xargs -n1 -i bash -c "echo -n 164.85.216.{} - ; nslookup 164.85.216.{} |grep name"|tr -s ' ' ' '|awk '{print $1" - "$5}'|sed 's/.$//' 's/.$//' "$5}'|sed - $1" '{print '|awk ' ' ' -s name"|tr |grep 164.85.216.{} nslookup ; - 164.85.216.{} -n "echo -c bash -i -n1 4|xargs seq seq 4|xargs -n1 -i bash -c "echo -n 164.85.216.{} - ; nslookup 164.85.216.{} |grep name"|tr -s ' ' ' '|awk '{print $1" - "$5}'|sed 's/.$//'rootopen.com
linux命令:seq 4|xargs -n1 -i bash -c "echo -n 164.85.216.{} - ; nslookup 164.85.216.{} |grep name"|tr -s ' ' ' '|awk '{print $1" - "$5}'|sed 's/.$//' 's/.$//' "$5}'|sed - $1" '{print '|awk ' ' ' -s name"|tr |grep 164.85.216.{} nslookup ; - 164.85.216.{} -n "echo -c bash -i -n1 4|xargs seq seq 4|xargs -n1 -i bash -c "echo -n 164.85.216.{} - ; nslookup 164.85.216.{} |grep name"|tr -s ' ' ' '|awk '{print $1" - "$5}'|sed 's/.$//'rootopen.com
2018-03-20 02:54:48

linux命令:seq 10 |xargs -n1 echo Printing line line Printing echo -n1 |xargs 10 seq seq 10 |xargs -n1 echo Printing linerootopen.com
linux命令:seq 10 |xargs -n1 echo Printing line line Printing echo -n1 |xargs 10 seq seq 10 |xargs -n1 echo Printing linerootopen.com
2018-01-25 05:04:48

linux命令:seq -w 100 | sed 's/^/login/' 's/^/login/' sed | 100 -w seq seq -w 100 | sed 's/^/login/'rootopen.com
linux命令:seq -w 100 | sed 's/^/login/' 's/^/login/' sed | 100 -w seq seq -w 100 | sed 's/^/login/'rootopen.com
2018-04-05 07:12:48

linux命令:seq 1 5 | parallel ssh {}.cluster.net uptime uptime {}.cluster.net ssh parallel | 5 1 seq seq 1 5 | parallel ssh {}.cluster.net uptimerootopen.com
linux命令:seq 1 5 | parallel ssh {}.cluster.net uptime uptime {}.cluster.net ssh parallel | 5 1 seq seq 1 5 | parallel ssh {}.cluster.net uptimerootopen.com
2017-12-26 07:01:48

linux命令:seq -s" " -50 -1 | tr -dc - - -dc tr | -1 -50 " -s" seq seq -s" " -50 -1 | tr -dc -rootopen.com
linux命令:seq -s" " -50 -1 | tr -dc - - -dc tr | -1 -50 " -s" seq seq -s" " -50 -1 | tr -dc -rootopen.com
2018-06-10 10:51:48

linux命令:seq -s'#' 0 $(tput cols) | tr -d '[:digit:]' '[:digit:]' -d tr | cols) $(tput 0 -s'#' seq seq -s'#' 0 $(tput cols) | tr -d '[:digit:]'rootopen.com
linux命令:seq -s'#' 0 $(tput cols) | tr -d '[:digit:]' '[:digit:]' -d tr | cols) $(tput 0 -s'#' seq seq -s'#' 0 $(tput cols) | tr -d '[:digit:]'rootopen.com
2018-04-16 20:17:48

linux命令:seq 8 | awk '{print "e(" $0 ")" }' | bc -l -l bc | }' ")" $0 "e(" '{print awk | 8 seq seq 8 | awk '{print "e(" $0 ")" }' | bc -lrootopen.com
linux命令:seq 8 | awk '{print "e(" $0 ")" }' | bc -l -l bc | }' ")" $0 "e(" '{print awk | 8 seq seq 8 | awk '{print "e(" $0 ")" }' | bc -lrootopen.com
2017-12-26 08:17:48

linux命令:seq -w 50 | sort -R | head -6 |fmt|tr " " "-" "-" " " |fmt|tr -6 head | -R sort | 50 -w seq seq -w 50 | sort -R | head -6 |fmt|tr " " "-"rootopen.com
linux命令:seq -w 50 | sort -R | head -6 |fmt|tr " " "-" "-" " " |fmt|tr -6 head | -R sort | 50 -w seq seq -w 50 | sort -R | head -6 |fmt|tr " " "-"rootopen.com
2017-12-31 03:56:48

linux命令:seq -f"%g^2" -s "+" 10 | bc bc | 10 "+" -s -f"%g^2" seq seq -f"%g^2" -s "+" 10 | bcrootopen.com
linux命令:seq -f"%g^2" -s "+" 10 | bc bc | 10 "+" -s -f"%g^2" seq seq -f"%g^2" -s "+" 10 | bcrootopen.com
2018-05-02 05:10:48

linux命令:seq -s "+" 3 | bc bc | 3 "+" -s seq seq -s "+" 3 | bcrootopen.com
linux命令:seq -s "+" 3 | bc bc | 3 "+" -s seq seq -s "+" 3 | bcrootopen.com
2018-05-30 18:49:48

linux命令:seq 100000 | paste -sd+ | bc bc | -sd+ paste | 100000 seq seq 100000 | paste -sd+ | bcrootopen.com
linux命令:seq 100000 | paste -sd+ | bc bc | -sd+ paste | 100000 seq seq 100000 | paste -sd+ | bcrootopen.com
2018-02-01 05:34:48

linux命令:seq 1000 | paste -sd+- | bc bc | -sd+- paste | 1000 seq seq 1000 | paste -sd+- | bcrootopen.com
linux命令:seq 1000 | paste -sd+- | bc bc | -sd+- paste | 1000 seq seq 1000 | paste -sd+- | bcrootopen.com
2018-02-19 08:47:48

linux命令:seq 1 2 99999999 | sed 's!^!4/!' | paste -sd-+ | bc -l -l bc | -sd-+ paste | 's!^!4/!' sed | 99999999 2 1 seq seq 1 2 99999999 | sed 's!^!4/!' | paste -sd-+ | bc -lrootopen.com
linux命令:seq 1 2 99999999 | sed 's!^!4/!' | paste -sd-+ | bc -l -l bc | -sd-+ paste | 's!^!4/!' sed | 99999999 2 1 seq seq 1 2 99999999 | sed 's!^!4/!' | paste -sd-+ | bc -lrootopen.com
2018-03-17 12:23:48

linux命令:seq -s* 10 |bc |bc 10 -s* seq seq -s* 10 |bcrootopen.com
linux命令:seq -s* 10 |bc |bc 10 -s* seq seq -s* 10 |bcrootopen.com
2018-04-24 17:44:48

linux命令:seq -s^2+ 11 |rev| cut -d'+' -f2- | rev | bc bc | rev | -f2- -d'+' cut |rev| 11 -s^2+ seq seq -s^2+ 11 |rev| cut -d'+' -f2- | rev | bcrootopen.com
linux命令:seq -s^2+ 11 |rev| cut -d'+' -f2- | rev | bc bc | rev | -f2- -d'+' cut |rev| 11 -s^2+ seq seq -s^2+ 11 |rev| cut -d'+' -f2- | rev | bcrootopen.com
2018-04-08 05:33:48

linux命令:seq 20 | awk 'ORS=NR%5?FS:RS' 'ORS=NR%5?FS:RS' awk | 20 seq seq 20 | awk 'ORS=NR%5?FS:RS'rootopen.com
linux命令:seq 20 | awk 'ORS=NR%5?FS:RS' 'ORS=NR%5?FS:RS' awk | 20 seq seq 20 | awk 'ORS=NR%5?FS:RS'rootopen.com
2018-03-09 04:23:48

linux命令:seq 1 255 | parallel -j+0 'nc -w 1 -z -v 192.168.1.{} 80' 80' 192.168.1.{} -v -z 1 -w 'nc -j+0 parallel | 255 1 seq seq 1 255 | parallel -j+0 'nc -w 1 -z -v 192.168.1.{} 80'rootopen.com
linux命令:seq 1 255 | parallel -j+0 'nc -w 1 -z -v 192.168.1.{} 80' 80' 192.168.1.{} -v -z 1 -w 'nc -j+0 parallel | 255 1 seq seq 1 255 | parallel -j+0 'nc -w 1 -z -v 192.168.1.{} 80'rootopen.com
2018-03-11 04:56:48

linux命令:seq 20 | sed '5,6 { w out.txt }' #Can't print correctly. See sample output output sample See correctly. print #Can't }' out.txt w { '5,6 sed | 20 seq seq 20 | sed '5,6 { w out.txt }' #Can't print correctly. See sample outputrootopen.com
linux命令:seq 20 | sed '5,6 { w out.txt }' #Can't print correctly. See sample output output sample See correctly. print #Can't }' out.txt w { '5,6 sed | 20 seq seq 20 | sed '5,6 { w out.txt }' #Can't print correctly. See sample outputrootopen.com
2018-02-28 13:05:48

linux命令:seq 9 | sed 'H;g' | awk -v RS='' '{for(i=1;i<=NF;i++)printf("%dx%d=%d%s", i, NR, i*NR, i==NR?"\n":"\t")}' i==NR?"\n":"\t")}' i*NR, NR, i, '{for(i=1;i<=NF;i++)printf("%dx%d=%d%s", RS='' -v awk | 'H;g' sed | 9 seq seq 9 | sed 'H;g' | awk -v RS='' '{for(i=1;i<=NF;i++)printf("%dx%d=%d%s", i, NR, i*NR, i==NR?"\n":"\t")}'rootopen.com
linux命令:seq 9 | sed 'H;g' | awk -v RS='' '{for(i=1;i<=NF;i++)printf("%dx%d=%d%s", i, NR, i*NR, i==NR?"\n":"\t")}' i==NR?"\n":"\t")}' i*NR, NR, i, '{for(i=1;i<=NF;i++)printf("%dx%d=%d%s", RS='' -v awk | 'H;g' sed | 9 seq seq 9 | sed 'H;g' | awk -v RS='' '{for(i=1;i<=NF;i++)printf("%dx%d=%d%s", i, NR, i*NR, i==NR?"\n":"\t")}'rootopen.com
2018-01-08 13:15:48

linux命令:seq 1 3 20 | sed -n '1{h;d};H;x;s/\n/\t/p' | awk '{printf("%d - %d = %d\n", $2, $1, $2-$1)}' $2-$1)}' $1, $2, %d\n", = %d - '{printf("%d awk | '1{h;d};H;x;s/\n/\t/p' -n sed | 20 3 1 seq seq 1 3 20 | sed -n '1{h;d};H;x;s/\n/\t/p' | awk '{printf("%d - %d = %d\n", $2, $1, $2-$1)}'rootopen.com
linux命令:seq 1 3 20 | sed -n '1{h;d};H;x;s/\n/\t/p' | awk '{printf("%d - %d = %d\n", $2, $1, $2-$1)}' $2-$1)}' $1, $2, %d\n", = %d - '{printf("%d awk | '1{h;d};H;x;s/\n/\t/p' -n sed | 20 3 1 seq seq 1 3 20 | sed -n '1{h;d};H;x;s/\n/\t/p' | awk '{printf("%d - %d = %d\n", $2, $1, $2-$1)}'rootopen.com
2018-05-06 10:59:48

linux命令:seq 1 3 20 | awk '{ T[NR]=$1} END {for (i=1;i<=(NR-1);i++) print T[i+1],"-",T[i],"=" , T[i+1]-T[i]}' T[i+1]-T[i]}' , T[i+1],"-",T[i],"=" print (i=1;i<=(NR-1);i++) {for END T[NR]=$1} '{ awk | 20 3 1 seq seq 1 3 20 | awk '{ T[NR]=$1} END {for (i=1;i<=(NR-1);i++) print T[i+1],"-",T[i],"=" , T[i+1]-T[i]}'rootopen.com
linux命令:seq 1 3 20 | awk '{ T[NR]=$1} END {for (i=1;i<=(NR-1);i++) print T[i+1],"-",T[i],"=" , T[i+1]-T[i]}' T[i+1]-T[i]}' , T[i+1],"-",T[i],"=" print (i=1;i<=(NR-1);i++) {for END T[NR]=$1} '{ awk | 20 3 1 seq seq 1 3 20 | awk '{ T[NR]=$1} END {for (i=1;i<=(NR-1);i++) print T[i+1],"-",T[i],"=" , T[i+1]-T[i]}'rootopen.com
2018-02-09 08:34:48

linux命令:seq 1 1000000 | while read i; do echo -en "\r$i"; done done "\r$i"; -en echo do i; read while | 1000000 1 seq seq 1 1000000 | while read i; do echo -en "\r$i"; donerootopen.com
linux命令:seq 1 1000000 | while read i; do echo -en "\r$i"; done done "\r$i"; -en echo do i; read while | 1000000 1 seq seq 1 1000000 | while read i; do echo -en "\r$i"; donerootopen.com
2018-03-14 22:45:48

linux命令:seq -f 'echo %g' $NUM | sh sh | $NUM %g' 'echo -f seq seq -f 'echo %g' $NUM | shrootopen.com
linux命令:seq -f 'echo %g' $NUM | sh sh | $NUM %g' 'echo -f seq seq -f 'echo %g' $NUM | shrootopen.com
2018-01-13 20:27:48

linux命令:seq 1 5 | xargs -I"#" date --date="today -# days" +'%Y-%m-%d' +'%Y-%m-%d' days" -# --date="today date -I"#" xargs | 5 1 seq seq 1 5 | xargs -I"#" date --date="today -# days" +'%Y-%m-%d'rootopen.com
linux命令:seq 1 5 | xargs -I"#" date --date="today -# days" +'%Y-%m-%d' +'%Y-%m-%d' days" -# --date="today date -I"#" xargs | 5 1 seq seq 1 5 | xargs -I"#" date --date="today -# days" +'%Y-%m-%d'rootopen.com
2018-01-21 22:22:48

linux命令:seq 2 100 | factor | sed '/ .* / d ; s/:.*//' s/:.*//' ; d / .* '/ sed | factor | 100 2 seq seq 2 100 | factor | sed '/ .* / d ; s/:.*//'rootopen.com
linux命令:seq 2 100 | factor | sed '/ .* / d ; s/:.*//' s/:.*//' ; d / .* '/ sed | factor | 100 2 seq seq 2 100 | factor | sed '/ .* / d ; s/:.*//'rootopen.com
2018-06-09 07:30:48

linux命令:seq 10| shuf | head -1 -1 head | shuf 10| seq seq 10| shuf | head -1rootopen.com
linux命令:seq 10| shuf | head -1 -1 head | shuf 10| seq seq 10| shuf | head -1rootopen.com
2018-03-08 00:58:48

Linux的Bash命令行(A-Z排序)