for i in {0001..1000}
do
echo "some text" > "file_${i}.txt"
done
Run Code Online (Sandbox Code Playgroud)
或者如果你想使用Python <2.6
for x in range(1000):
open("file%03d.txt" % x,"w").write("some text")
Run Code Online (Sandbox Code Playgroud)
#!/bin/bash
seq 1 1000 | split -l 1 -a 3 -d - file
Run Code Online (Sandbox Code Playgroud)
上面将创建1000个文件,每个文件的编号从1到1000.文件将命名为file000 ... file999