Jump to content

Recommended Posts

Posted

Добрый вечер. Форматирую отчет о звонках командой

cat CDRReport-2017Jan17.115323.csv | awk -F "," '{print $1 "," $2 "," $7 "," $9 "," $9}'

Получаю вывод вида:

«2016-12-01 09:01:20»,«364420»,«Local/501@from-queue-0000030a;1»,«123s (2m 3s)»,«123s (2m 3s)»

Как можно в поле «Local/501@from-queue-0000030a;1»(оно же $7) убрать слева часть текста до «/»(включая «/»), а справа убрать часть текста после «@»(включая «@»). Тоже самое только в последнем поле «123s (2m 3s)», убрать все справа до «s»(включая «s»), так чтобы осталось только число(в данном примере 123).

PS:

substr($7, 8, 3)

не подходит, так как не будет работать для четырехзначных номеров.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...