分类: LINUX
2009-01-14 23:23:25
for i in `cat txt` do v=`echo $i |awk -F = '{printf $2}'` case $v in 1)v1=`echo $i |awk -F = '{printf $2}'`;; 2)v2=`echo $i |awk -F = '{printf $2}'`;; 3)v3=`echo $i |awk -F = '{printf $2}'`;; 4)v4=`echo $i |awk -F = '{printf $2}'`;; esac done
echo "v1=$v1" echo "v2=$v2" echo "v3=$v3" echo "$v4" |
v1=1 v2=2 v3=3 v4=4
3.执行:
$test.sh
v1=1
v2=2
v3=3
v4=4