由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - script问题----运行多个文件
相关主题
Is there any software can D/L a whole directory?how to delete these files
Remove core.xxxx files?how to count the total number of lines
How to find the pdf file?"Find ... -exec ..." script never ends.
请教怎样使用tar压文件[转载] 再请教高手
How to mv files to another directory under ftp> ?how to write a recursive fcn using ksh to find all the occurances of a file?
is it possible to untar files with absolute path?Korn shell script
how to download a dir and its files under ftpShell problem: read a file
how to copy whole directory files?Shell Script: about soft link
相关话题的讨论汇总
话题: control话题: data话题: program话题: files话题: example
进入Unix版参与讨论
1 (共1页)
e*******r
发帖数: 2
1
the problem I am having is that:
under a directory there are many data files with the same suffix,
for example,
control/a1.wp control/a2.wp ... control/a100.wp
I will have to run a program using the given data file to
output a new data file, for example
exec_program control/a1.wp control/a1new.wp
the problem is, since there are lots of *.wp files, it's really painful
for me to run all these one by one manually. I remember once I saw sth alike
was done by using sed. I want to know if there is a s
c**o
发帖数: 166
2
How about this one:
#!/bin/sh
for i in `ls control/a*.wp`
do
head=`echo $i | awk -F"." '{print $1}'`
new="new"
exec_program $head.wp $head$new.wp
done
Did not test it. Use it at your own risk. :)
Is Shuke also your ID? :)

can

【在 e*******r 的大作中提到】
: the problem I am having is that:
: under a directory there are many data files with the same suffix,
: for example,
: control/a1.wp control/a2.wp ... control/a100.wp
: I will have to run a program using the given data file to
: output a new data file, for example
: exec_program control/a1.wp control/a1new.wp
: the problem is, since there are lots of *.wp files, it's really painful
: for me to run all these one by one manually. I remember once I saw sth alike
: was done by using sed. I want to know if there is a s

1 (共1页)
进入Unix版参与讨论
相关主题
Shell Script: about soft linkHow to mv files to another directory under ftp> ?
home directory突然丢失!is it possible to untar files with absolute path?
a painful problemhow to download a dir and its files under ftp
Help! shell programminghow to copy whole directory files?
Is there any software can D/L a whole directory?how to delete these files
Remove core.xxxx files?how to count the total number of lines
How to find the pdf file?"Find ... -exec ..." script never ends.
请教怎样使用tar压文件[转载] 再请教高手
相关话题的讨论汇总
话题: control话题: data话题: program话题: files话题: example