Reply
Thread Tools
Posts: 10 | Thanked: 29 times | Joined on Jun 2010 @ Germany
#11
Originally Posted by saponga View Post
Does anyone wrote a script that i can adapt to my case ?
Try this in the folder where your vcf files are:
Code:
grep -l ':+[89][0-9]\{7\}$' *.vcf | xargs sed -i '/:+[89][0-9]\{7\}$/s/\+/\+9/g'
I'm not sure if I installed sed from the repositories or if it's part of maemo anyway. So If sed is not found, you'll have to install it.
 

The Following User Says Thank You to Obsidian For This Useful Post:
Posts: 147 | Thanked: 150 times | Joined on Aug 2010 @ Finland
#12
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.
 

The Following User Says Thank You to Aonsaithya For This Useful Post:
Posts: 432 | Thanked: 917 times | Joined on Jun 2011
#13
Originally Posted by Obsidian View Post
Try this in the folder where your vcf files are:
Code:
grep -l ':+[89][0-9]\{7\}$' *.vcf | xargs sed -i '/:+[89][0-9]\{7\}$/s/\+/\+9/g'
.
Thanks bro... I did try it on my kali box but:
Code:
~/Exported contacts$ grep -l ':+[89][0-9]\{7\}$' *.vcf | xargs sed -i '/:+[89][0-9]\{7\}$/s/\+/\+9/g'
sed: no input files
I should try to debug your line but i really didn't understand anything
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 '
/:+[89][0-9]\{7\}$/s/\+/\+9/g'
sed: -i requires an argument
Thanks again buddy !!!

Last edited by saponga; 2014-04-30 at 15:11.
 
Posts: 432 | Thanked: 917 times | Joined on Jun 2011
#14
Originally Posted by Aonsaithya View Post
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.
That is a good idea... Although i'll wait and see if someone has already managed to solve that situation using (b)ash.
Thanks for the tip !!!
 
Posts: 10 | Thanked: 29 times | Joined on Jun 2010 @ Germany
#15
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.
 

The Following User Says Thank You to Obsidian For This Useful Post:
Posts: 191 | Thanked: 415 times | Joined on Jan 2012
#16
I have a quick script for the br scenario. I look 4 it and post later.
 

The Following User Says Thank You to caveman For This Useful Post:
Posts: 432 | Thanked: 917 times | Joined on Jun 2011
#17
Originally Posted by Obsidian View Post
The command should be in one line with no breaks.
Well... i just did a copy/paste...

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 ($)
Thanks for your patience. I'll try to understand that line for sure.

Maybe you find a pattern that works or you give me an anonymised vcf-file for testing purposes.
Thanks again. I'm attatching a .vcf file.
Attached Files
File Type: txt Alice.vcf.txt (163 Bytes, 51 views)
 
Posts: 432 | Thanked: 917 times | Joined on Jun 2011
#18
Originally Posted by caveman View Post
I have a quick script for the br scenario. I look 4 it and post later.
I'll really apreciate that. Thanks.
 
Posts: 10 | Thanked: 29 times | Joined on Jun 2010 @ Germany
#19
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'
 

The Following User Says Thank You to Obsidian For This Useful Post:
peterleinchen's Avatar
Posts: 4,117 | Thanked: 8,901 times | Joined on Aug 2010 @ Ruhrgebiet, Germany
#20
@saponga
Is this
Code:
sed  '/:[89][0-9]\{7\}\>/s/:/:9/g' -i *.vcf
what you are looking for?

@obsidian
there should be no need for xargs, or?
$ did not work so I used \>
__________________
SIM-Switcher, automated SIM switching with a Double (Dual) SIM adapter
--
Thank you all for voting me into the Community Council 2014-2016!

Please consider your membership / supporting Maemo e.V. and help to spread this by following/copying this link to your TMO signature:
[MC eV] Maemo Community eV membership application, http://talk.maemo.org/showthread.php?t=94257

editsignature, http://talk.maemo.org/profile.php?do=editsignature
 

The Following User Says Thank You to peterleinchen For This Useful Post:
Reply


 
Forum Jump


All times are GMT. The time now is 17:08.