unix - 生成连续编号的 url
问题描述
我想生成一个包含以下行的文本文件:
http://example.com/file1.pdf
http://example.com/file2.pdf
http://example.com/file3.pdf
.
.
http://example.com/file1000.pdf
请问有人可以建议如何使用unix命令行来做到这一点吗?
谢谢
解决方案
带有一个交互 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
推荐阅读
- azure - Azure 表存储:如何以可靠的方式保存相同数据的多个副本
- oracle - Oracle Internet Directory 12.2.1.3.0 oid_setup 命令错误
- amazon-web-services - AWS Batch 输出到 Step Functions
- python-3.x - 为 Pandas 中的缺失值估算组平均值
- mysql - 如何回填 MySQL 中的列?
- android - 在 Sketchware 中包含命令行?
- github - 意外的 github 动作触发器
- progressive-web-apps - 渐进式网络应用程序会在 Amazon Fire 7 上运行吗?
- ansible - Ansible 将保管库密码文件传递给 playbook
- python - (熊猫)当我同时使用 loc 和列名时,我无法赋值