avatar
e*e
1
I have a data file like this:
A B C D
1 2 3 4
2 3 3 34
* * * *
I want to read these number and assign them to some variables, something like:
1st time:
var1=1, var2=2 var3=3, var4=4
then do something with these Var*
then 2nd time
var2=2, var2=3, var3=3 var4=34
then do something....
and so on.
How to do it in C shell script?
Thanks.
cat
avatar
c*t
2
why not use perl?

【在 e****e 的大作中提到】
: I have a data file like this:
: A B C D
: 1 2 3 4
: 2 3 3 34
: * * * *
: I want to read these number and assign them to some variables, something like:
: 1st time:
: var1=1, var2=2 var3=3, var4=4
: then do something with these Var*
: then 2nd time

avatar
a*n
3
In Bourne shell..
#############################
#if you file is like "a b c d"
#!/bin/sh
while read var1 var2 var3 var4
do
: #the command you want
done < filename
##############################

【在 e****e 的大作中提到】
: I have a data file like this:
: A B C D
: 1 2 3 4
: 2 3 3 34
: * * * *
: I want to read these number and assign them to some variables, something like:
: 1st time:
: var1=1, var2=2 var3=3, var4=4
: then do something with these Var*
: then 2nd time

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