a*n
3 楼
#!/bin/sh -xv
#To get little hints please delete -xv flags
#remove first three lines of everyfile in current directory
#except the shell program
for file in `ls`
do
if ( test -f $file && test $file != `basename $0` )
then
sed 1,3d $file > $file.tmp
mv $file.tmp $file
else
echo "$0: $file can't be changed" 1>&2
fi
done
【在 R**g 的大作中提到】
: 怎么把一个目录下的所有文件的前3行删除?
: 谢谢!
#To get little hints please delete -xv flags
#remove first three lines of everyfile in current directory
#except the shell program
for file in `ls`
do
if ( test -f $file && test $file != `basename $0` )
then
sed 1,3d $file > $file.tmp
mv $file.tmp $file
else
echo "$0: $file can't be changed" 1>&2
fi
done
【在 R**g 的大作中提到】
: 怎么把一个目录下的所有文件的前3行删除?
: 谢谢!
R*g
4 楼
thank you very much. It really saves me lots of time.
【在 a***n 的大作中提到】
: #!/bin/sh -xv
: #To get little hints please delete -xv flags
: #remove first three lines of everyfile in current directory
: #except the shell program
: for file in `ls`
: do
: if ( test -f $file && test $file != `basename $0` )
: then
: sed 1,3d $file > $file.tmp
: mv $file.tmp $file
【在 a***n 的大作中提到】
: #!/bin/sh -xv
: #To get little hints please delete -xv flags
: #remove first three lines of everyfile in current directory
: #except the shell program
: for file in `ls`
: do
: if ( test -f $file && test $file != `basename $0` )
: then
: sed 1,3d $file > $file.tmp
: mv $file.tmp $file
相关阅读
关于perl和linux shell script的书最经典有哪些? (转载)Solaris 8系统求助如何在console 上启动emacs?怎么undelete文件?一般用户?how to count the times a function is called还是只认3.6G内存,大虾分析一下把 (转载)请教关于查cpu信息的命令初级awk问题哪位能推荐适于C/C++ 编程的linux/unix使用手册?Need help: Apache 2 problem, Solaris 10help on replacing text in a file (转载)你们安装那个Solaris 10 ?请教一个文件处理的问题happy new year, one security related question (UNIX)How to pop out the unix window?请教大虾们: 怎么能快速学会写Makefile【请教】在Solaris下开发和Linux开发有什么不同? (转载)how to count string times using perlps command 为何不显示 emacs process?如何在linux 启动时自动执行 xinetd?