![]() |
Re: Convert all Contact Numbers
Quote:
Code:
grep -l ':+[89][0-9]\{7\}$' *.vcf | xargs sed -i '/:+[89][0-9]\{7\}$/s/\+/\+9/g' |
Re: Convert all Contact Numbers
I'd just sync the contacts to Outlook or similar, export them to an excel file, modify the information with functions or such and finally reverse the process to get the updates to the phone.
In fact, I think I have done that some time in the past. |
Re: Convert all Contact Numbers
Quote:
Code:
~/Exported contacts$ grep -l ':+[89][0-9]\{7\}$' *.vcf | xargs sed -i '/:+[89][0-9]\{7\}$/s/\+/\+9/g' And, yes, the .vcf files are in that folder. Am i missing something ? edit: busybox gives me another output: Code:
~/MyDocs/Exported contacts $ grep -l ':+[89][0-9]\{7\}$' *.vcf | xargs sed -i ' |
Re: Convert all Contact Numbers
Quote:
Thanks for the tip !!! |
Re: Convert all Contact Numbers
The command should be in one line with no breaks.
It's a combination of two commands: the grep lists all the files that match the pattern (regular expression) and hands them over to the sed, that does the find & replace part. If the grep doesn't find any files, it won't work. The pattern I used is: 1. a colon (:) 2. a plus-sign (+) 3. either 8 or 9 4. seven digits (from 0 to 9) 5. end of line ($) Maybe you find a pattern that works or you give me an anonymised vcf-file for testing purposes. |
I have a quick script for the br scenario. I look 4 it and post later.
|
Re: Convert all Contact Numbers
1 Attachment(s)
Quote:
Quote:
Quote:
|
Re: Convert all Contact Numbers
Quote:
|
Re: Convert all Contact Numbers
I see, there's no leading plus sign. Just remove it from the pattern in the grep command and in the sed command and it should work:
Code:
grep -l ':[89][0-9]\{7\}$' *.vcf | xargs sed -i '/:[89][0-9]\{7\}$/s/\+/\+9/g' |
Re: Convert all Contact Numbers
@saponga
Is this Code:
sed '/:[89][0-9]\{7\}\>/s/:/:9/g' -i *.vcf @obsidian there should be no need for xargs, or? $ did not work so I used \> |
All times are GMT. The time now is 21:52. |
vBulletin® Version 3.8.8