- 论坛徽章:
- 145
|
本帖最后由 jason680 于 2011-04-18 09:48 编辑
待处理的文本 cat tmpfile:
system
ibrav= 12 celldm(1)= 10.38828296
celldm(3)= 4.4403 ...
huazhorg 发表于 2011-04-18 08:36 ![]()
别在用a,b,c,d了,阵列也很好用...- $ echo 'system
- ibrav= 12 celldm(1)= 10.38828296
- celldm(3)= 4.44037202
- nat= 22, ntyp=4
- '| awk 'BEGIN{for(i=0;i<4;i++)celldm[i]=0}
- {if(match($0,/celldm\(([0-9])\)= ([-0-9.]+)/,v))celldm[v[1]]=v[2]}
- END{for(i=0;i<4;i++)printf("celldm[%d]=%s\n",i,celldm[i])}'
- celldm[0]=0
- celldm[1]=10.38828296
- celldm[2]=0
- celldm[3]=4.44037202
复制代码 |
|