#!/bin/sh # TEL;TYPE=CELL,VOICE:0118765-4321 for i in *.vcf; do sed -i -r -f 9th-digit-tim.sed $i done
# remove format chars /^TEL/ s/[\(\)\ \.-]//g # cell phones of SP with 8 digits -> 0 41 DDD 9XXXX /^TEL/ s/:(1[1-9])([6-9][0-9]{3})([0-9]{4})/:0 41 \1 9\2 \3/p /^TEL/ s/:0(1[1-9])([6-9][0-9]{3})([0-9]{4})/:0 41 \1 9\2 \3/p # cell phones without ddd /^TEL/ s/:([6-9][0-9]{3})([0-9]{4})/:9\1 \2/p # cell phone with ddd /^TEL/ s/:([2-9][1-9])([6-9][0-9]{3})([0-9]{4})/:0 41 \1 \2 \3/p /^TEL/ s/:0([2-9][1-9])([6-9][0-9]{3})([0-9]{4})/:0 41 \1 \2 \3/p # non-cell phones /^TEL/ s/:([2-5][0-9]{3})([0-9]{4})/:\1 \2/p /^TEL/ s/:(1[1-9])([2-5][0-9]{3})([0-9]{4})/:0 41 \1 \2 \3/p /^TEL/ s/:0(1[1-9])([2-5][0-9]{3})([0-9]{4})/:0 41 \1 \2 \3/p