"sed" and "awk" gurus - some help with parsing...

torontob

Joined
May 18, 2008
Messages
219
Likes
0
Points
0
#1
Hi Guys,

I have a trunk that I want to place calls through it with only 1 or 2 channels at certain times. So, I have a smart context which checks for time but since the calls are placed through A2Billing, I can't use GROUP and GROUP_COUNT functions (or at least I don't know how to put them to use; if someone can guide me on those for my purpose it would be amazing).

So, I am looking into sed and awk to see how many channels are up. Something along this line:

gawk -F: '{ print $1 $2 }' | asterisk -rx "sip show channels"

But above really doesn't work. Hence, I need help from awk and sed gurus to fix above so that the output would be something like this:

Peer User/ANR Call ID Format Hold Last Message
211.122.119.44 (None) 1494f1886210ef1 0x0 (g729) No Rx: REGISTER
211.122.111.24 (None) 354739ec53a364b 0x0 (ulaw) No Rx: REGISTER

So, using awk I should output:
211.122.119.44 g729
211.122.111.24 ulaw

But that doesn't happen.

Anyone can guide please?

Thanks
 

Members online

No members online now.

Latest posts

Forum statistics

Threads
30,902
Messages
130,886
Members
17,564
Latest member
Mai Tuyen
Top