e****e 发帖数: 179 | 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 | c**t 发帖数: 2744 | 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
| a**n 发帖数: 313 | 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
|
|