-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 El 2007-01-19 a las 17:41 +0100, Camaleón escribió:
El 19/01/07, Carlos E. R. escribió:
Lo tenía preparado los anexos, pero de repente me he dado cuenta que tiene errores.
Tsk, tsk...
(Nota mental: creo que voy a empezar a leer tus correos de abajo hacia arriba, que es donde está "la chicha" :-D)
Es que según escribo, voy pensando, pero no borro lo anterior, es "el histórico".
Espera, es que soy yo el que necesita café, es mi hora de la siesta O:-)
¿Siesta? ¿Eso que es...? :-P
Algo que debería ser obligatorio ;-)
A ver, examino una que el calc pone mal, la linea 5.
Ya está, ya veo el problema. Hay puntos y comas entre las comillas originales que no son el separador de campo:
Pues eso decía en el correo anterior:
<correo anterior> han utilizado puntos y comas y comillas para separar campos y dentro del texto, es de locos.
Sí, lo recuerdo.
No funciona, hay otroproblema en la linea 1123 y algunas más, pero eso sí que no lo miro ahora. ¡Mi siesta!
Carlos, en estos casos hay que decir, sencillamente: ¡que se vayan a freir espárragos!, es un formato infumable. Se supone que ponen los ficheros para facilitar el trabajo, pero ya ves...
Ya lo he solucionado elimiando a lo bruto las columnas que dan error, las que llevan ";" en medio de las "" y rompen la transformación.
Pues yo tengo curiosidad. A ver, la linea 1123 original es: [Inciso: Había un tipo de letra en xterm que se llamaba "unreadable", y que ya no viene, pero que necesito para ciertos copypastes - de una tacada podría empastar la linea siguiente] "5";"040630100080";"0406 30 10"; "-- In the manufacture of which no cheeses other than Emmentaler, Gruyère and Appenzell have been used and which may contain, as an addition, Glarus herb cheese (known as Schabziger); put up for retail sale, of a fat content by weight in the dry matter not exceeding 56 %";"Processed cheese, not grated or powdered, in the manufacture of which no cheeses other than Emmentaler, Gruyère and Appenzell have been used and which may contain, as an addition, Glarus herb cheese "known as Schabziger"; put up for retail sale, of a fat content by weight in the dry matter of <= 56%";"Fromages fondus, autres que râpés ou en poudre, dans la fabrication desquels ne sont pas entrés d''autres fromages que l''emmental, le gruyère et l''appenzell et, éventuellement, à titre additionnel, du fromage de Glaris aux herbes [dit ''schabziger''], conditionnés pour la vente au détail, d''une teneur en matières grasses en poids de la matière sèche <= 56%";"Schmelzkäse, weder gerieben noch in Pulverform, zu dessen Herstellung keine anderen Käsesorten als Emmentaler, Greyerzer und Appenzeller, und gegebenenfalls als Zusatz auch Glarner Kräuterkäse "sog. Schabziger" verwendet worden sind, in Aufmachungen für den Einzelverkauf, mit einem Fettgehalt in der Trockenmasse von <= 56 GHT" Menuda parrafada en una sóla linea. Partámoslo: Level;Code;Code; "5";"040630100080";"0406 30 10"; Description; "-- In the manufacture of which no cheeses other than Emmentaler, Gruyère and Appenzell have been used and which may contain, as an addition, Glarus herb cheese (known as Schabziger); put up for retail sale, of a fat content by weight in the dry matter not exceeding 56 %"; Supplementary unit;Description of supplementary unit; "-";""; Hasta aquí el OOo lo hace bien. Self-explanatory texts in English;Self-explanatory texts in French;Self-explanatory texts in German "Processed cheese, not grated or powdered, in the manufacture of which no cheeses other than Emmentaler, Gruyère and Appenzell have been used and which may contain, as an addition, Glarus herb cheese "known as Schabziger"; put up for retail sale, of a fat content by weight in the dry ^ En ese punto y coma se corta, y pasa a la siguiente celda. ¿Eso puede ser culpa de mi programita? Pues si que lo es..: "known as Schabziger|put up for retail sale ^ Pues si que... un bug conocido. Veamos... joer: if (c1= char($22)) and (c2=char($3B)) and (c1= char($22)) {";"} Tiene que ser: if (c1= char($22)) and (c2=char($3B)) and (c3= char($22)) {";"} ¿Será posible el despiste? Fale, pues corregido. Ya importa el OOo-calc las 15148 lineas correctamente. El programita queda así: program quitacomillascsv; var c1,c2,c3: char; contador: longword; skip: word; begin contador:= 0; skip:= 0; while not eof(input) and (contador < 3) do begin c1:= c2; c2:= c3; read(c3); inc(contador); end; {variables inicializada} {Excepcion inicial tratada} while not eof(input) do begin c1:= c2; c2:= c3; read(c3); inc(contador); if skip > 0 then begin dec(skip); continue; end; if (c1= char($22)) and (c2=char($3B)) and (c3= char($22)) {";"} then begin write('|'); skip:=2; continue; end; if (c1= char($22)) and (c2= char($0D)) and (c3= char($22)) {"^M"} then begin write(char($0A)); skip:=2; continue; end; write(c1); end; end. Y no te libras, que te lo voy a mandar al privado :-P Lo que no entiendo es en qué se queda trabajando el OOo con ese fichero cuando lo abro, está un cuarto de hora con toda la cpu que puede pillar, hasta que termina nosequé y descansa. - -- Saludos Carlos E. R. -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2 (GNU/Linux) Comment: Made with pgp4pine 1.76 iD8DBQFFsU/ntTMYHG2NR9URAlQfAJ4kUbYn9uQh+WeNQIDp/QMXg5w2cACfY98k A5toEeNfQS0rs1Jhe/KwuBc= =TpPm -----END PGP SIGNATURE-----