scripts
scripts copied to clipboard
`contacts-convert-vcf-from.sh` deletes leading "+" signs from international telephone numbers.
The international calling prefix (see https://en.wikipedia.org/wiki/List_of_international_call_prefixes ) is in many countries "00" (double null), but in some telephone systems something else. The ITU prescribes using the "+" sign as standard. In my telephone I apparently have numbers following both conventions.
I noticed that contacts-convert-vcf-from.sh drops these "+" symbols from telephone numbers.
I would say that it is better to leave the plusses in place and convert leading double-nulls to a plus.
Something like this:
(TEL*)
# Do not delete + sign, used to indicate foreign numbers. Normalize 00 to +.
# vTEL=$( echo "${LINE}" | awk -F ':' '{print $2}' | tr -d ' ' | tr -d '-' | tr -d '[]()' )
vTEL=$( echo "${LINE}" | awk -F ':' '{print $2=="tel"?$3:$2}' | tr -d ' ' | tr -d '-' | tr -d '[]()' | sed 's/^00/+/' )
if [ -z ${vTELS} ]
...
The handling of $2 or $3 is because vCard version 4 files start a tel.nr., as a URL, with "tel:"