首页 > 解决方案 > 生成连续编号的 url

问题描述

我想生成一个包含以下行的文本文件:

http://example.com/file1.pdf
http://example.com/file2.pdf
http://example.com/file3.pdf
.
.
http://example.com/file1000.pdf

请问有人可以建议如何使用unix命令行来做到这一点吗?

谢谢

标签: unixurltext-filesgeneratenumbered

解决方案


带有一个交互 for 循环

for (( i=1;i<=1000;i++ ));
do 
    echo "http://example.com/file$i.pdf";
done > newfile

带序列:

while read i;
do 
   echo "http://example.com/file$i.pdf";
done <<< $(seq 1000) > newfile

推荐阅读