Question on SoGo Address book

,

Hi,

I have a simple but complex question on how to handle the address book entries. I collected phone numbers from collegues in a company. Now imagine the following:

The company changed its name. The Company changed the telephone service - just three digits were changed (+41 56 456 7890 → +41 68 456 7890).

Q: is there any way to handle / alter the addresse book entries “like in a speedsheet”? - just replace a column by a given value?

I do not know if export to ldif works - most critical would be the merge back on import

TIA
Thorsten

NethServer Version: your_version
Module: your_module

The personal address book is stored in a mysql db, in my case the sogomarkus0026488ee58 db. Sogo saves the address info as vcard which is just text.

I used phpmyadmin to browse the DBs and to run following SQL query. It replaces all 123 with 456 when the company name is “CompanyName”.

UPDATE `sogomarkus0026488ee58` SET c_content = replace(c_content, '123', '456') WHERE c_content LIKE '%CompanyName%';`

It worked in my test but I recommend virtualization snapshots, backups or at least a db backup before changing entries.

You may export the LDIF (text file) and do a search/replace but 3 digits are too less to be successful, you might end with a lot of phone numbers changed…

The import in Sogo is intended for first import of an old address book, there are no options and reimporting an exported LDIF results in duplicates so I think this is not an option.

Thanks, @rmarkuz, for your help. I was hoping to edit columns in a table. Your solution will work for a few strings to be changed manualle, - but I feard an answer like that … my problem is not that simple…

By Change, do you know if the SQL command “Update” can be usind within a loop where multiple expressions are searched and replaced? Would it be possible to deliver a dataset of two columns with “find string” - > “replace by string” ?

Best regards
Thorsten

The problem is that an addressbook dataset has one text field called c_content with the complete address information. Even if you had it in a table, it’s not easy to edit.

You wrote

so please explain the problem…

The update command “loops” through the complete address book and changes all numbers assigned to a company. There’s nothing to change manually.

I don’t think so but you can run one update with the first string to replace and a second one with the second string to replace.

1 Like