- 論壇徽章:
- 145
|
本帖最后由 jason680 于 2015-09-14 13:01 編輯
回復(fù) 17# tengfei0311
It's a shell command without '$'
$ head -1 test
$awk -vst=13 -vmax=150 -vmul=5 '{
$ awk -f test
awk: test:1: $awk -vst=13 -vmax=150 -vmul=5 '{
awk: test:1: ^ syntax error
...
$ cat test
awk -vst=13 -vmax=150 -vmul=5 '{
if(S0!="")
print S0;
if(NR>=st)
total+=S1;
S0=$0;
S1=$1;
}
END{
diff=max-total;
if(diff<0){
print S0;
exit;
}
sub(/[^ ]+/,"5.000",S0);
for(n=0;n<=diff;n+=mul)
print S0;
}' test.mod
$ bash test
MODEL.01
...
H(KM) VP(KM/S) VS(KM/S) RHO(GM/CC) QP QS ETAP ETAS FREFP FREFS
2.0000 6.100 3.550 2.740 849. 600. 0.00 0.00 1.00 1.00
...
2.0000 7.000 3.990 2.950 849. 600. 0.00 0.00 1.00 1.00
5.000 8.120 4.510 849. 600. 0.00 0.00 1.00 1.00
...
5.000 8.120 4.510 849. 600. 0.00 0.00 1.00 1.00
|
|