** 表示中文:
步骤:
1.先出一个统一的文件shell.sh:
2.用awk命令:
生成如下:
**1000.txt
**1001.txt
**1002.txt
.
.
.
在Linux下想把中文**去掉,如下:**1001.txt
**1002.txt
.
.
.
mv *1001.txt 1001.txt
mv *1002.txt 1002.txt
mv *1003.txt 1003.txt
mv *1004.txt 1004.txt
mv *1005.txt 1005.txt
mv *1006.txt 1006.txt
mv *1007.txt 1007.txt
mv *1008.txt 1008.txt
.
.
.
如何生成如上的语句?mv *1002.txt 1002.txt
mv *1003.txt 1003.txt
mv *1004.txt 1004.txt
mv *1005.txt 1005.txt
mv *1006.txt 1006.txt
mv *1007.txt 1007.txt
mv *1008.txt 1008.txt
.
.
.
步骤:
1.先出一个统一的文件shell.sh:
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
2.用awk命令:
num=1000;
cat shell.sh |awk -F"1000" '{print $1 '$num'+NR $2 '$num'+NR $3}'
cat shell.sh |awk -F"1000" '{print $1 '$num'+NR $2 '$num'+NR $3}'
生成如下:
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
.
.
.
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
mv *1000.txt 1000.txt
.
.
.
作者:jackxiang@向东博客 专注WEB应用 构架之美 --- 构架之美,在于尽态极妍 | 应用之美,在于药到病除
地址:https://jackxiang.com/post/2430/
版权所有。转载时必须以链接形式注明作者和原始出处及本声明!
最后编辑: jackxiang 编辑于2009-12-31 10:41
评论列表