1
나는 그 내용이 다음과 같이됩니다 MyFile.xml이awk 명령 및 변수 할당
<root>
<Main>
<someothertag>..</someothertag>
<Amt Ccy="EUR">13</Amt>
</Main>
.
.
.
some other tags
<Main>
<someothertag>..</someothertag>
<Amt Ccy="SGD">10</Amt>
</Main>
<another>
<Amt Ccy="EUR">10</Amt>
</another>
</root>
나는 그 내용
result = `awk '/<Main>/ { f=1 } f && /Amt/ { split($0,a,/[<>]/); s+=a[3] } /<\/Main>/ { f=0 } END {print s }' MyFile.xml`
echo "The result is " $result
다음과 같습니다 그러나 내가
로 출력을 얻고 스크립트 파일이result: 0653-690 Cannot open =.
result: 0653-690 Cannot open 23.
The result is
내 예상 출력은
입니다.The result is 23
http://stackoverflow.com/questions/2268104/basic-bash-script-variable-declaration-command-not-found/2268117#2268117 –