Menu

Main Menu
Talk Get Daily Search

Member's Online

    User Name
    Password

    Convert all Contact Numbers

    Reply
    Page 3 of 3 | Prev |   1     2   3 |
    saponga | # 21 | 2014-05-01, 20:51 | Report

    Originally Posted by peterleinchen View Post
    @saponga
    Is this
    Code:
    sed  '/:[89][0-9]\{7\}\>/s/:/:9/g' -i *.vcf
    what you are looking for ?
    Woow \o/ Thank you very much !!! It worked like a charm.

    Edit | Forward | Quote | Quick Reply | Thanks

     
    peterleinchen | # 22 | 2014-05-01, 20:56 | Report

    You are welcome.

    obsidian was almost right:
    But/And I do also understand why the $ (end of line anchor) did not work but \> (end of word) does?

    Edit | Forward | Quote | Quick Reply | Thanks

     
    caveman | # 23 | 2014-05-02, 19:40 | Report

    Recently I formatted all my numbers. The procedure used a small shell script and a sed script, and was run on the N9.


    The steps are as follows:
    0. make a backup and verify it works
    1. clear the contacts dir
    2. export all contacts to vcf files
    3. run the script in the contacts dir
    4. delete all contacts
    5. reimport them as follows: in the contacts dir, do a "cat *.vcf > all.vcf" and import the all.vcf file.

    Here follows the scripts I used. First the shell script:
    Code:
    #!/bin/sh
    
    # TEL;TYPE=CELL,VOICE:0118765-4321
    for i in *.vcf; do
    	sed -i -r -f 9th-digit-tim.sed $i
    done
    The sed script improves the number presentation, inserts the 9th digit and operator code.

    Please test and adapt to your case before using on the device.
    Code:
    # 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

    Edit | Forward | Quote | Quick Reply | Thanks
    The Following User Says Thank You to caveman For This Useful Post:
    saponga

     
    Page 3 of 3 | Prev |   1     2   3 |
vBulletin® Version 3.8.8
Normal Logout