Linuxコマンドライン言語であるBashでのBashコマンドseqを利用して、テキストコンテンツ、中身のあるファイルを規則的に生成する方法について紹介します。
ASUS:/mnt/c/pg/$ seq 1 3 | xargs -I {} bash -c "echo {} > {}.txt"
ASUS:/mnt/c/pg/$ ls
1.txt 2.txt 3.txt
ASUS:/mnt/c/pg/$ cat 1.txt 2.txt 3.txt
1
2
3
Linuxコマンドライン言語であるBashでのBashコマンドseqを利用して、テキストコンテンツ、中身のあるファイルを規則的に生成する方法について紹介します。
ASUS:/mnt/c/pg/$ seq 1 3 | xargs -I {} bash -c "echo {} > {}.txt"
ASUS:/mnt/c/pg/$ ls
1.txt 2.txt 3.txt
ASUS:/mnt/c/pg/$ cat 1.txt 2.txt 3.txt
1
2
3