当时我使用了sh式布局,我对一些事情没有什么麻烦。 在Matlab执行的情况似乎非常容易,但是由于我试图与方案互动,我需要在终点站这样做。
So here s what I want to do: I have a file del.txt that is structured like this
页: 1
2 P-4月, 2 P-3月, 2 FS, 2 NS
3月
4月
etc. So each value is in it s own row and there s one column for all the data. I have a bunch of other files that are within my directory. I want to match up say value 页: 1 (which in this case is 页: 1) with file 页: 1 and value 2 P-4月, 2 P-3月, 2 FS, 2 NS with file 2 P-4月, 2 P-3月, 2 FS, 2 NS, etc and so on and so forth. So here s what I did...
法典:
(cat del.txt
)
foreach sta(ls *.HHZ
)
echo a is $a
echo $sta
cat <<页: 1>>macro.m
页: 1
r 主 费
页: 1
sac macro.m
rm macro.m
结束
结束
However what I achieve is that it loops through all of the values in del.txt and each file and then moves on to the next file within my directory and loops through all of the values. I m having trouble figuring out the format that this should be in to match up the correct values. I m not doing much within the script yet until I can get them to match up. Please help Can someone tell me what I m doing wrong? I read that the foreach command will execute all the commands on each file..but haven t been able to find a way to get around this. What I want it to do is take value 页: 1 from del.txt and match it up with file 页: 1 (sta) from the directory finish the loop, then take value 2 P-4月, 2 P-3月, 2 FS, 2 NS from del.txt and match it up with file 2 P-4月, 2 P-3月, 2 FS, 2 NS from the directory (sta). I ve never done more than just simple iterations with csh on one subset of files, and I am not sure how to reference the values to one another. Any help would be greatly appreciated. I haven t found a simple way to do this without writing everything out. I looked at the for and while commands..if there is a simple way to do it I m not seeing it.
Cheers, K