Redian新闻
>
script问题----运行多个文件
avatar
script问题----运行多个文件# Unix - 噫吁兮,危乎高哉
e*r
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
avatar
c*o
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

相关阅读
logo
联系我们隐私协议©2024 redian.news
Redian新闻
Redian.news刊载任何文章,不代表同意其说法或描述,仅为提供更多信息,也不构成任何建议。文章信息的合法性及真实性由其作者负责,与Redian.news及其运营公司无关。欢迎投稿,如发现稿件侵权,或作者不愿在本网发表文章,请版权拥有者通知本网处理。