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
相关阅读
[转载] How to compare the CPU time of two algorithms?Help wanted for CURSESHow to apply "patch" to a directory ?关于display的问题[转载] 主页问题how to print ' in awk and sed.批处理求助Re: 如何用grep查找子目录下的文件?--stop!有用FreeBSD的么?Unix 下的中文环境Makefile help!awk求助how to remove ^M in my file为什么我就是不会写Shell script?Abort(coredump) ??????????????甚至文件权限C之一问How can I input Chinese under Solaris/intel?哪里有下载整个网站的工具(in unix)psnup help?Question about Cxterm: how to add fonts when using X terminal?