当前位置: 首页 > Linux

Linux_112

时间:2023-04-06 23:20:17 Linux

的seq命令打印从第一个数字到尾数指定增量的数字。seq命令用于生成从某个数字到另一个数字的所有整数。命令语法>seq[option]...mantissa>seq[option]...firstnumbermantissa>seq[option]...firstnumberincrementmantissa命令选项-f,--format=format使用printf样式浮点格式-s,--separator=string使用指定字符串分隔数字(默认使用:\n)-w,--equal-width在列前加0使宽度与指定格式相同display>seq-f"%3g"1012345678910%10%后指定的位数默认为%g、%3g,则位数不足的部分默认为空格。指定显示格式,不足位用0补足>seq-f"%03g"10001002003004005006007008009010指定3位显示,不足3位用0补足指定显示格式,不足位用0补足,加astringinfront>seq-f"rumen%03g"10rumen001rumen002rumen003rumen004rumen005rumen006rumen007rumen008rumen009rumen010如果是这样,则位数小于0,在%前建立字符串。指定与输出编号同宽>seq-w1001020304050607080910不能和-f一起使用,输出同宽。指定分隔符(默认为回车)>seq-s""1012345678910>seq-s"#"101#2#3#4#5#6#7#8#9#10指定/t作为分隔符>seq-s"`echo-e"\t"`"1012345678910批量创建文件>touch$(seq-f"rumenz%03g.txt"10)>ls-al*.txt-rw-r--r--1rootroot0Apr422:46rumenz001.txt-rw-r--r--1rootroot0Apr422:46rumenz002.txt-rw-r--r--1rootroot0Apr422:46rumenz003.txt-rw-r--r--1rootroot0Apr422:46rumenz004.txt-rw-r--r--1rootroot0Apr422:46rumenz005.txt-rw-r--r--1rootroot0Apr422:46rumenz006.txt-rw-r--r--1rootroot0Apr422:46rumenz007.txt-rw-r--r--1rootroot0Apr422:46rumenz008.txt-rw-r--r--1rootroot0Apr422:46rumenz009.txt-rw-r--r--1rootroot0Apr422:46rumenz010.txt倒序显示数字>eq10-1110987654321十进制序列>seq-f"%f"10.531.0000001.5000002.0000002.5000003.000000-f十进制显示,步长为0.5小数序列,指定小数位数>seq-f"%.2f"10.531.001.502.002.503.00%.2f显示2位小数,步长为0.5原文链接:https://rumenz.com/rumenbiji/...微信公众号:入门站