由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Unix版 - 如何在perl中运行c-shell file?
相关主题
相关话题的讨论汇总
话题: file话题: shell话题: fortran话题: perl话题: think
进入Unix版参与讨论
1 (共1页)
w*******h
发帖数: 8
1
现有一c-shell file, 它可以调用一个fortune程序, 但是每次只能执行一个输入纪录,得
到一个输出结果. 为了能让它执行多个纪录, 另外写一个脚本程序(use perl),做循环,每
遇到一个纪录九调用一次c-shell file, 处理这个纪录, 得到输出结果, 请问在perl中如
何调用c-shell file?
thanks in advanced
q*****m
发帖数: 73
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

w*******h
发帖数: 8
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.

q*****m
发帖数: 73
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

w*******h
发帖数: 8
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

q*****m
发帖数: 73
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

w*******h
发帖数: 8
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.

q*****m
发帖数: 73
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.

w*******h
发帖数: 8
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?

q*****m
发帖数: 73
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"

q*****m
发帖数: 73
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

w*******h
发帖数: 8
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.

q*****m
发帖数: 73
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??

w*******h
发帖数: 8
14
i will think about it, hehe
anyway, thanks

【在 q*****m 的大作中提到】
: Splitting is easiest for you.
1 (共1页)
进入Unix版参与讨论
相关主题
相关话题的讨论汇总
话题: file话题: shell话题: fortran话题: perl话题: think