currently, I am using a SQLite database with开发者_开发问答 some addresses and telephone numbers. All phone numbers are stored as text without the international prefix, e.g. 0123 / 4567890. Now, I would like to store them in the international format with the country prefix, +49 123 4567890 in the example above. As there are several hundreds of datasets, I am searching for a bash script, maybe even a single SQL command, whatever fits best to reformat all those entries at once.
Thanks in advance!
Here's a simple SQLite UPDATE query to convert 0 prefix to +49 country code and remove / and spaces.
UPDATE tablename SET tel = '+49'||replace(replace(substr(tel,2), '/',''), ' ', '') WHERE tel LIKE '0%';
精彩评论