pwd
ls sphere*.cas|awk -F"-" 'BEGIN{i=1}{print substr($5,0,length($5)-4),",",i; i=i+1}'
pwd
# ls *.cas|awk -F"-" '{print $5}'
# ls sphere*.cas|awk -F"-" 'BEGIN{i=1}{print substr($5,0,length($5)-8),",",i; i=i+1}'
#
ls sphere*.cas|awk -F"-" 'BEGIN{i=1;prefix="sphere12-14-15-1.csv";}{print substr($5,0,length($5)-4),",",i >prefix; i=i+1}'
ls *.cas|awk -F"-" 'BEGIN{i=1;prefix="sphere12-14-15-1-";postfix=".cas"}
{originalFile=prefix""substr($5,0,length($5)-4);cmd="rename "originalFile" "sprintf("%03d",i)" "originalFile""postfix;i=i+1;print(cmd);}'
一定要重视测试,现在测试明眼一看就有问题!!!!!!
ls *.dat|awk -F"-" 'BEGIN{i=1;prefix="sphere12-14-15-1-";postfix=".dat"}
{originalFile=prefix""substr($5,0,length($5)-4);cmd="rename "originalFile" "i" "originalFile""postfix;i=i+1;print(cmd);}'
rename第二列是要替换的表达式 第三列是要替换的形式(缩列形式) 第四列是文件名
ls *.cas|awk -F"-" 'BEGIN{i=1;prefix="sphere12-14-15-1-";postfix=".cas"}
{originalFile=prefix""substr($5,0,length($5)-4);cmd="rename "originalFile" "i" "originalFile""postfix;i=i+1;system(cmd);}'
ls *.dat|awk -F"-" 'BEGIN{i=1;prefix="sphere12-14-15-1-";postfix=".dat"}
{originalFile=prefix""substr($5,0,length($5)-4);cmd="rename "originalFile" "i" "originalFile""postfix;i=i+1;system(cmd);}'
开始进行tecplot处理
需要把tecplot路径放到path中! 事先录制好脚本,安排好文件名字!
tec360.exe fluent17.mcr
cat sphere*.csv|awk -F, 'BEGIN{prefix="sphere12-14-15-1-";postfix=".cas"}
{output=prefix""substr($1,0,length($1)-1)""postfix;input=sprintf("%03d",$2)""postfix;cmd="rename "input" "output" "input;print cmd;}'
cat sphere*.csv|awk -F, 'BEGIN{prefix="sphere12-14-15-1-";postfix=".cas"}
{output=prefix""substr($1,0,length($1)-1)""postfix;input=sprintf("%03d",$2)""postfix;cmd="rename "input" "output" "input;system(cmd);}'
cat sphere*.csv|awk -F, 'BEGIN{prefix="sphere12-14-15-1-";postfix=".dat"}
{output=prefix""substr($1,0,length($1)-1)""postfix;input=sprintf("%03d",$2)""postfix;cmd="rename "input" "output" "input;system(cmd);}'