tildetel/microsip_contactlist.sh

2 lines
519 B
Bash
Executable File

printf "\357\273\277%s\n" "Name,Number,Presence,Directory" >tilde.tel.users.csv;{ curl https://tilde.tel/phonebook.html|grep -A 9999 "\[Tilde\]"|grep -B 9999 "</pre>"|tail -n +1|head -n -1|grep -v "<\(\|/\)pre>"|tr -s "[:blank:]" "\t"|while read i;do [ -n "$i" ]&&{ echo "$i"|grep -s "^[^.]*\.[^.]*";}&&{ realm="$(echo "$i"|cut -f 1)";rest="$(echo "$i"|cut -f 2-)";}||rest="$i";[ -n "$rest" ]&&echo "$realm $rest";done|tr -s "[:blank:]" "\t"|uniq|sort|awk -F "\t" '{print $3" ("$1"),"$2",1,0"}';} >>tilde.tel.users.csv