[asterisk-users] Quick bash tip for finding free SIP extensions from your sip.conf

Steve Edwards asterisk.org at sedwards.com
Thu Feb 2 17:34:37 CST 2012


On Thu, 2 Feb 2012, Kyle Sexton wrote:

> Created this function on one of my machines today, thought others might find it useful:
> freesip() {
> comm -2 <(seq $2 $3) <(cat $1 | grep ^\\[ | sort | uniq | tr -d \[ | tr -d \]) | grep ^[[:digit:]]
> }

Shave 4 processes:

freesip()
 	{
 	comm -2 -3\
 		<(seq $2 $3)\
 		<(grep ^\\[[[:digit:]] $1 | sort -u | tr -d \[])
 	}

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list