我想在新文件的列中打印以下内容
1_number_density_per_atom_1.xvg
1_number_density_per_atom_2.xvg
1_number_density_per_atom_3.xvg
.
.
.
1_number_density_per_atom_653.xvg
所以我想这个想法是写一些类似的东西
printf "%s\n" "1_number_density_per_atom_1.xvg" "1_number_density_per_atom_2.xvg" "1_number_density_per_atom_3.xvg" ... "1_number_density_per_atom_653.xvg" > test.dat
答案1
使用大括号扩展:
printf "%s\n" 1_number_density_per_atom_{1..653}.xvg > test.dat
答案2
使用GNU seq
:
seq -f 1_number_density_per_atom_%g.xvg 653 > test.dat