Seq命令的用法(shell)
for i in seq 1 10;
do
echo $i;
done
或者用
for i in $(seq 1 10)
也可以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-f 选项 指定格式
9
10
11
% 后面指定数字的位数 默认是"%g",
"%3g"那么数字位数不足部分是空格
% 前面制定字符串
seq -f "str%03g" 9 11
str009
str010
str011-w 指定输出数字同宽 不能和-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
输出是同宽的-s 指定分隔符 默认是回车
seq -s" " -f"str%03g" 9 11
str009 str010 str011
要指定t 做为分隔符号
seq -s"echo -e "\t"" 9 11指定nn作为分隔符号
seq -s"echo -e "\n\n"" 9 11
19293949596979899910911
得到的是个错误结果
不过一般也没有这个必要 它默认的就是回车作为分隔符
几个例子
awk BEGIN { while (num 10 ) printf "dir%03dn", ++num ; exit} | xargs mkdir
mkdir $(seq -f dir%03g 1 10)
for i in seq -f %02g 1 20
do
if ! wget -P $HOME/tmp -c http://www.xxxsite.com/photo/$i.jpg ; then
wget -P $HOME/tmp -c $_
fi
done
相关文章
- CentOS6.5菜鸟之旅:关于搜索的shell命令
- top命令中的wa指标(转)
- linux shell 脚本攻略学习11--mkdir和touch命令详解
- C++设计模式10--命令模式(二)(Command)--降低请求发送者与接收者耦合
- nodejs调用cmd命令
- linux shell 脚本攻略学习19--sed命令详解
- linux shell 脚本攻略学习18--grep命令详解
- linux shell 脚本攻略学习12--文件权限详解,chmod命令详解,chown命令详解,chattr命令详解
- 安全测试全面总结-5-shell命令注入漏洞
- Linux Shell脚本自动化编程实战- shell内置命令 break、continue
- 获取shell脚本自身所在目录的Shell脚本分享
- Shell命令替换:将命令的输出结果赋值给变量
- Linux shell test命令用法详解
- linux grep查找命令使用示例
- Hadoop 停止hdfs和yarn的命令
- Matlab绘图控制命令
- 一些shell命令
- Java设计模式菜鸟系列(七)命令模式建模与实现
- shell中test命令方法详解
- hadoop shell 命令
- 19.第六章 Shell脚本编程基础入门 -- shell 脚本语言的基本用法(二)
- windows 10 python subprocess.Popen cmd 命令
- Centos cut 命令
- 移动端测试===adb shell top命令解释
- 有关matplotlib的相关命令【查询版本|安装指定版本|卸载】
- Shell printf 命令
- shell - 02 - Shell的转折点:流程与控制
- shell - 08 - Shell文本处理三剑客 - sed -编辑命令详解
- Shell脚本的学习心得和知识总结(三)| shell语句