Accéder au contenu.
Menu Sympa

devel - [Devel] r350 - scripts

Objet : devel-adl

Archives de la liste

[Devel] r350 - scripts


Chronologique Discussions 
  • From: svn AT agendadulibre.org
  • To: devel AT agendadulibre.org
  • Subject: [Devel] r350 - scripts
  • Date: Thu, 10 Jul 2008 09:09:44 +0200 (CEST)
  • List-archive: <http://agendadulibre.org/pipermail/devel>
  • List-id: Developpement de l'Agenda du Libre <devel.agendadulibre.org>

Author: thomas
Date: Thu Jul 10 09:08:24 2008
New Revision: 350

Log:
Autre version du script, non basé sur xls2csv qui est
buggé. Utilisation d'OpenOffice.org Calc à la place (moins pratique,
mais fonctionne).



Modified:
scripts/extract-cities-coordinates.sh

Modified: scripts/extract-cities-coordinates.sh
==============================================================================
--- scripts/extract-cities-coordinates.sh (original)
+++ scripts/extract-cities-coordinates.sh Thu Jul 10 09:08:24 2008
@@ -1,10 +1,5 @@
#!/bin/sh

-if [ ! -x $(which xls2csv) ] ; then
- echo "Cannot find xls2csv. Please install catdoc package."
- exit 1
-fi
-
# Get the source file
wget http://www.galichon.com/codesgeo/data/ville.zip
if [ $? -ne 0 ] ; then
@@ -15,8 +10,21 @@
unzip ville.zip
rm -f ville.zip

-# Extract the XLS file to CSV
-xls2csv ville.xls -c'|' -q0 | \
+# I wish I could use xls2csv, but a bug prevents it do properly
+# extract the specific XLS file we are using. See
+# https://www.wagner.pp.ru/cgi-bin/cvstrac/catdoc/tktview?tn=24
+
+echo "I will start OpenOffice.org Calc."
+echo "Please save the file in CSV format, separated by pipes, with no
quotes, under the name ville.csv"
+echo "Press Enter when ready"
+read trash
+
+oocalc ville.xls
+
+echo "Press Enter when done"
+read trash
+
+cat ville.csv | \
# Remove useless spaces
sed 's/ *|/|/g;s/^ //' | \

@@ -26,4 +34,4 @@
# Generate the SQL queries
sed
"s/\([^|]*\)|\([^|]*\)|\([^|]*\)|\([^|]*\)|\([^|]*\)|\([^|]*\)|\([^|]*\)|\([^|]*\)/insert
into cities
(name,majname,postalcode,inseecode,regioncode,latitude,longitude) values
(\"\1\", '\2', '\3', '\4', '\5', '\6', '\7');/" > ville.sql

-rm -f ville.xls
\ No newline at end of file
+rm -f ville.xls ville.csv
\ No newline at end of file




  • [Devel] r350 - scripts, svn, 10/07/2008

Archives gérées par MHonArc 2.6.16.

Haut de le page