ログファイルをgrepしてcsvファイルに書き込みます。

ログファイルをgrepしてcsvファイルに書き込みます。

コールIDに基づいてユーザーに再生されるコーデックファイルを調べます。ユーザー/通話IDで2つのファイルが再生されました。このgrep出力を.csvファイルに書き込みます。使った

grep -oP "(?<=$START).*?(?=$END)" $IVRLOG$Progress_log>>$CURRENTPATH/op2.csv
welcome1.g711u #(call_id1)
Announcementbui4.g711u #(call_id1)
welcome1.g711u #(call_id2)
Announcementbui4.g711u #(call_id2)

しかし、私は出力です

welcome1.g711u,Announcementbui4.g711u #callid1
welcome1.g711u,Announcementbui4.g711u #callid2

                 

ベストアンサー1

grep -oP "(?<=$START).*?(?=$END)" $IVRLOG$Progress_log>>$CURRENTPATH/op2.csv | 
while read line; do
grep "callid" | sed 's/()()//g'  #removing the brackets
done

テストされていない新しい空間コードを処理する必要があるかもしれません。

おすすめ記事