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
|
|