-1
標籤SED:用逗號使用AWK分隔或低於所用逗號使用AWK分隔或標籤SED以下
[BEGIN AccountID]
[BEGIN CallerID]
[BEGIN Billed Account Attributes]
1111111
1111111
1111111
[END Billed Account Attributes]
[BEGIN OBIO Tax]
10
20
30
[END OBIO Tax]
[BEGIN RINO Tax]
777
888
999
[END RINO Tax]
[BEGIN CallerID]
[END AccountID]
[BEGIN AccountID]
[BEGIN CallerID]
[BEGIN Billed Account Attributes]
2222222
2222222
2222222
[END Billed Account Attributes]
[BEGIN OBIO Tax]
40
50
60
[END OBIO Tax]
[BEGIN CallerID]
[END AccountID]
我想AWK或sed腳本來打印:
1111111,1111111,1111111, 10,20,30, 777,888,999
2222222,2222222,2222222, 40,50,60, 0, 0, 0
....
....
....
用逗號分隔,並且在沒有顯示RINO TAX時放入ZERO。
非常感謝!
到目前爲止您嘗試過什麼?你能和我們分享一些代碼或想法嗎?如果我們知道你已經探索過什麼,那麼幫助就會更容易。 – Levon 2012-07-12 21:22:29
這是功課嗎? – 2012-07-13 13:46:56
這個我試過了: awk'BEGIN {OFS =「;」; }/^ \ [BEGIN AccountID \]/{f [nf = 0] = $ 0; while(getline && $ 0!〜/^\ [END AccountID \] /){f [++ nf] = $ 0;} print f [3],f [15];}'$ 1 – Oliveira 2012-07-13 15:54:41