Redian新闻
>
如何在perl中运行c-shell file?
avatar
如何在perl中运行c-shell file?# Unix - 噫吁兮,危乎高哉
w*h
1
现有一c-shell file, 它可以调用一个fortune程序, 但是每次只能执行一个输入纪录,得
到一个输出结果. 为了能让它执行多个纪录, 另外写一个脚本程序(use perl),做循环,每
遇到一个纪录九调用一次c-shell file, 处理这个纪录, 得到输出结果, 请问在perl中如
何调用c-shell file?
thanks in advanced
avatar
q*m
2
I think your problem can be solved by using c-shell alone.
Just read some tutorials on c-shell.

【在 w*******h 的大作中提到】
: 现有一c-shell file, 它可以调用一个fortune程序, 但是每次只能执行一个输入纪录,得
: 到一个输出结果. 为了能让它执行多个纪录, 另外写一个脚本程序(use perl),做循环,每
: 遇到一个纪录九调用一次c-shell file, 处理这个纪录, 得到输出结果, 请问在perl中如
: 何调用c-shell file?
: thanks in advanced

avatar
w*h
3
thanks, it will be good if i can do so
but my many records(150,000) are all in one file, i need to recognize one
record,pick it up into one single file, as what you said, just use c-shell
to run the fortune program, get the result for this record, print it into
the result file,
then recognize the next one....i think i need sth like pointer to move in
my big file, to recognize each record one by one, do you think if it can
be done so?
Thanks again

【在 q*****m 的大作中提到】
: I think your problem can be solved by using c-shell alone.
: Just read some tutorials on c-shell.

avatar
q*m
4
Just give you some hints, you need to get c-shell tutorial
and impliment yourself.
Say your fortran is run.exe, data is h001.dat, you run it as
run.exe < h001.dat>run.h001.dat.out
Now you have 100 data files, as h002.dat, etc. You can
[[
for datafilename in "ls *.dat"
do
run.exe < datafilename> run.datafilename.out
done
]]
Note the above is illustration only. You need to read the c-shell
turorial to get things right, which should not be that hard.

【在 w*******h 的大作中提到】
: thanks, it will be good if i can do so
: but my many records(150,000) are all in one file, i need to recognize one
: record,pick it up into one single file, as what you said, just use c-shell
: to run the fortune program, get the result for this record, print it into
: the result file,
: then recognize the next one....i think i need sth like pointer to move in
: my big file, to recognize each record one by one, do you think if it can
: be done so?
: Thanks again

avatar
w*h
5
you are right, but right now my situation is actually my 100 data files
are all in 1 big file, not individually 100 seperated files, I wonder
how c shell recognize each record in this big file? and then pick it up
into the standard input file one by one?
am i making myself clear? thanks :-)
btw, there are 150,000 records in this big file, maybe more in the
future

【在 q*****m 的大作中提到】
: Just give you some hints, you need to get c-shell tutorial
: and impliment yourself.
: Say your fortran is run.exe, data is h001.dat, you run it as
: run.exe < h001.dat>run.h001.dat.out
: Now you have 100 data files, as h002.dat, etc. You can
: [[
: for datafilename in "ls *.dat"
: do
: run.exe < datafilename> run.datafilename.out
: done

avatar
q*m
6
It is easy to split big file into small pieces, as long as you
know the seperator or how many lines of each. You can even do
that in Fortran within 5 minutes.

【在 w*******h 的大作中提到】
: you are right, but right now my situation is actually my 100 data files
: are all in 1 big file, not individually 100 seperated files, I wonder
: how c shell recognize each record in this big file? and then pick it up
: into the standard input file one by one?
: am i making myself clear? thanks :-)
: btw, there are 150,000 records in this big file, maybe more in the
: future

avatar
w*h
7
i am really sorry i add my supplemental notes in my last post late
"there are 150,000 records in my big file, maybe more in the future"

【在 q*****m 的大作中提到】
: It is easy to split big file into small pieces, as long as you
: know the seperator or how many lines of each. You can even do
: that in Fortran within 5 minutes.

avatar
q*m
8
wait a minute, can't you just modify the dam FORTRAN and
solve the problem once for all?

【在 q*****m 的大作中提到】
: It is easy to split big file into small pieces, as long as you
: know the seperator or how many lines of each. You can even do
: that in Fortran within 5 minutes.

avatar
w*h
9
haha, this is my another problem that i think i can't solve
actually, this fortune program is Amsol
http://comp.chem.umn.edu/amsol/
i dont' think i can modify that program, wuwuwu
also, i also need to modify again when new version is released

【在 q*****m 的大作中提到】
: wait a minute, can't you just modify the dam FORTRAN and
: solve the problem once for all?

avatar
q*m
10
modify your fortran. done!

【在 w*******h 的大作中提到】
: i am really sorry i add my supplemental notes in my last post late
: "there are 150,000 records in my big file, maybe more in the future"

avatar
q*m
11
Then try to split the file, You can do it in Fortran, C, C++, c-sh,
tcsh, bash, perl. python, ...
Too many choices.

【在 w*******h 的大作中提到】
: haha, this is my another problem that i think i can't solve
: actually, this fortune program is Amsol
: http://comp.chem.umn.edu/amsol/
: i dont' think i can modify that program, wuwuwu
: also, i also need to modify again when new version is released

avatar
w*h
12
you mean trying to split this file into 150,000 individual files?
is it a little bit crazy?
if i can use other program that makes a loop to run this c-sh file,
do you think if it is more easier than to split it??

【在 q*****m 的大作中提到】
: Then try to split the file, You can do it in Fortran, C, C++, c-sh,
: tcsh, bash, perl. python, ...
: Too many choices.

avatar
q*m
13
Splitting is easiest for you.

【在 w*******h 的大作中提到】
: you mean trying to split this file into 150,000 individual files?
: is it a little bit crazy?
: if i can use other program that makes a loop to run this c-sh file,
: do you think if it is more easier than to split it??

avatar
w*h
14
i will think about it, hehe
anyway, thanks

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