Hey all... I have a CSV file which has the following lines: (about 6k entries...)
Joe Smith,joe@foofoo.com,3333,,
Trying to parse each line and insert the $1,$2,$4 fields into:
[3333]
type=friend
username=Joe Smith
host=dynamic
secret=3333
context=gateway
callerid="Joe Smith"<2125551212>
nat=no
call-limit=1000"
while read list.csv
do
name=`awk '{print $1,$2}' list.csv`
ext=`awk '{ gsub(/,/, " ");print $4} list.csv`
awk '{print "[$ext]\ntype=friend\nusername="$ext"\nhost=dynamic\nsecret="$ext"\ncontext=gateway\ncallerid="$name"<2125551212>\nnat=no\ncall-limit=1000\n"}' list.csv
done
-bash: read: `list.csv': not a valid identifier
perl -e 'print $i=pack(c5,(40*2),sqrt(7600),(unpack(c,Q)-3+1+3+3-7),oct(104),10,oct(101));'
Joe Smith,joe@foofoo.com,3333,,
Trying to parse each line and insert the $1,$2,$4 fields into:
[3333]
type=friend
username=Joe Smith
host=dynamic
secret=3333
context=gateway
callerid="Joe Smith"<2125551212>
nat=no
call-limit=1000"
while read list.csv
do
name=`awk '{print $1,$2}' list.csv`
ext=`awk '{ gsub(/,/, " ");print $4} list.csv`
awk '{print "[$ext]\ntype=friend\nusername="$ext"\nhost=dynamic\nsecret="$ext"\ncontext=gateway\ncallerid="$name"<2125551212>\nnat=no\ncall-limit=1000\n"}' list.csv
done
-bash: read: `list.csv': not a valid identifier
perl -e 'print $i=pack(c5,(40*2),sqrt(7600),(unpack(c,Q)-3+1+3+3-7),oct(104),10,oct(101));'