473,387 Members | 1,465 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Borrar una linea en un TXT

Hola de nuevo a todos...
Agradecido a todos los que me habeis solucionado problemas anteriores...

Pero como no es novedad, me surge otro.

Recientemente buscando, adquiri un codigo para juntar 3 ficheros de texto.
El cual adapte para el desarrollo de mi DB.
El proceso es genial, pues junto los tres ficheros pulsando solo un boton.
(O determinada accion EVENTOS)

Peroooooooo¡¡¡¡¡¡

Siempre hay un pero.

Bien os comento.
El proceso lo hace fenomenal y no es problema del juntado de los ficheros, o
almenos eso creo.

Cuado yo generlos los ficheros TXT, mediante una SALIDAHACIATEXTO, dando
formato a los campos y colocando a distancias XXXX, este genera el fichero
de txt, bien, pero despues de la ultima linea escrita o generada, introduce
una linea en blanco, o un salto de linea, lo cual implica que en el
fusionado de los ficheros, no queden juntos los datos, si no que hay un
salto de linea, entre medias de los ficheros fusionados...

Alguno sabe como poder eliminar esa linea sobrante antes o durante la fusion
de los ficheros.

Os ajunto muestra de los ficheros para que podais haceros una idea mejor.

FICHERO1
----------------------
START-OF-LOG: 2.0
CONTEST: MUNICIPIOS DE ESPAÑA
CALLSIGN: EA4AYW
CATEGORY: SINGLE-OP ALL LOW SSB
CLAIMED-SCORE: 00000
OPERATORS:
NAME: JORGE GALLARDO SANCHEZ
ADDRESS: C/ LISBOA,7
ADDRESS: 28693 QUIJORNA
ADDRESS: MADRID / ESPAÑA
SOAPBOX: RECIBAN MIS MAS CORDIALES SALUDOS 73´
SOAPBOX:
SOAPBOX:
CREATED-BY: EXPURELOC V 3.0
FICHERO2
----------------------
QSO: 144 PH 2002-03-02 1515 EA4AYW 59 001 IN70XK EA2AAZ 59
010 IN93AH
QSO: 144 PH 2002-03-02 1516 EA4AYW 59 002 IN70XK EB4AFK 59
004 IN80EK
QSO: 144 PH 2002-03-02 1517 EA4AYW 59 003 IN70XK EA4BAS 59
003 IN80HL
QSO: 144 PH 2002-03-02 1522 EA4AYW 59 004 IN70XK F6FHP 55
004 IN94TR
QSO: 144 PH 2002-03-02 1527 EA4AYW 59 005 IN70XK EA7JX 59
003 IM77BM

FICHERO3
----------------------
END-OF-LOG:
El resultado de dicha fusion es:

FICHERO RESULTADO DE LA FUSION
-----------------------------------------------

START-OF-LOG: 2.0
CONTEST: MUNICIPIOS DE ESPAÑA
CALLSIGN: EA4AYW
CATEGORY: SINGLE-OP ALL LOW SSB
CLAIMED-SCORE: 00000
OPERATORS:
NAME: JORGE GALLARDO SANCHEZ
ADDRESS: C/ LISBOA,7
ADDRESS: 28693 QUIJORNA
ADDRESS: MADRID / ESPAÑA
SOAPBOX: RECIBAN MIS MAS CORDIALES SALUDOS 73´
SOAPBOX:
SOAPBOX:
CREATED-BY: EXPURELOC V 3.0

QSO: 144 PH 2002-03-02 1515 EA4AYW 59 001 IN70XK EA2AAZ 59
010 IN93AH
QSO: 144 PH 2002-03-02 1516 EA4AYW 59 002 IN70XK EB4AFK 59
004 IN80EK
QSO: 144 PH 2002-03-02 1517 EA4AYW 59 003 IN70XK EA4BAS 59
003 IN80HL
QSO: 144 PH 2002-03-02 1522 EA4AYW 59 004 IN70XK F6FHP 55
004 IN94TR
QSO: 144 PH 2002-03-02 1527 EA4AYW 59 005 IN70XK EA7JX 59
003 IM77BM

END-OF-LOG:
El fichero que deberia generar correctamente y que me es valido es:

FICHERO BUENO:
----------------------------
START-OF-LOG: 2.0
CONTEST: MUNICIPIOS DE ESPAÑA
CALLSIGN: EA4AYW
CATEGORY: SINGLE-OP ALL LOW SSB
CLAIMED-SCORE: 00000
OPERATORS:
NAME: JORGE GALLARDO SANCHEZ
ADDRESS: C/ LISBOA,7
ADDRESS: 28693 QUIJORNA
ADDRESS: MADRID / ESPAÑA
SOAPBOX: RECIBAN MIS MAS CORDIALES SALUDOS 73´
SOAPBOX:
SOAPBOX:
CREATED-BY: EXPURELOC V 3.0

QSO: 144 PH 2002-03-02 1515 EA4AYW 59 001 IN70XK EA2AAZ 59
010 IN93AH
QSO: 144 PH 2002-03-02 1516 EA4AYW 59 002 IN70XK EB4AFK 59
004 IN80EK
QSO: 144 PH 2002-03-02 1517 EA4AYW 59 003 IN70XK EA4BAS 59
003 IN80HL
QSO: 144 PH 2002-03-02 1522 EA4AYW 59 004 IN70XK F6FHP 55
004 IN94TR
QSO: 144 PH 2002-03-02 1527 EA4AYW 59 005 IN70XK EA7JX 59
003 IM77BM
END-OF-LOG:

Os muestro el codigo que estoy usando para la fusion:

MODULO
-------------

Public Function Cabrillo()
Dim cadena As String
Open CurrentProject.Path & "\Cabrillo.log" For Append As #1
Open CurrentProject.Path & "\CaDat.txt" For Input As #2
Open CurrentProject.Path & "\Ca.txt" For Input As #3
Open CurrentProject.Path & "\CaEnd.txt" For Input As #4

cadena = Input(LOF(2), #2)
Print #1, cadena

cadena = Input(LOF(3), #3)
Print #1, cadena

cadena = Input(LOF(4), #4)
Print #1, cadena
Close
End Function

EVENTO O BOTON DE FORMULARIO AL HACER CLICK
----------------------------------------------------------------------
Private Sub Comando16_Click()
On Error GoTo EtiquetaError_Err
Dim Retval
Call Cabrillo
Retval = Shell("notepad.exe " & CurrentProject.Path & "\Cabrillo.log",
vbMaximizedFocus)
EtiquetaError_Exit:
Exit Sub
EtiquetaError_Err:
MsgBox Error$
Resume EtiquetaError_Exit
End Sub
Bueno, alguna idea ???

El problema esta en que cuando yo realizo la exportacion a texto, es decir
cuando yo genero cada fichero en cuestion, este introduce un retorno de
carro, o enter, o un salto de linea, en vez de quedarse al final de los
datos.

Se me ocurren dos soluciones:

1ª Tratar el fichero de txt directamente borrando la ultima linea, (Si es
que se puede)
2º Al generar el fichero de txt, hacer queno de un salto de linea desde mis
ultimos datos.. (Que no se si sepuede tampoco)

Si se os ocurre algo me gustaria saberlo...

Gracias a todos...
Nov 12 '05 #1
3 15992
Saludos de Virginia, los E.E.U.U., cerca de la C.C. de Washington.

Aparece que sus archivos de TXT contienen retornos del carro. Usted
puede evitar esto revisando el código que genera el archivo de
"Cabrillo.log".

El código debe evaluar cada línea que venga de los archivos
originales, y escribe esa línea a Cabrillo.log solamente si no
contiene avance de línea o retorno del carro.

El equivalente del avance de línea es "Chr(10)", y el equivalente de
un retorno del carro es "Chr(13)". El código pudo parecer esto:

Open CurrentProject.Path & "\Cabrillo.log" For Append As #1
Open CurrentProject.Path & "\CaDat.txt" For Input As #2
Open CurrentProject.Path & "\Ca.txt" For Input As #3
Open CurrentProject.Path & "\CaEnd.txt" For Input As #4

cadena = Input(LOF(2), #2)
if Trim(Cadena) <> Chr(13) and Left(Trim(Cadena),1) <> Chr(10) then
Print #1, cadena

cadena = Input(LOF(3), #3)
if Trim(Cadena) <> Chr(13) and Left(Trim(Cadena),1) <> Chr(10) then
Print #1, cadena

cadena = Input(LOF(4), #4)
if Trim(Cadena) <> Chr(13) and Left(Trim(Cadena),1) <> Chr(10) then
Print #1, cadena

Esto debe quitar linefeeds y retornos del carro de Cabrillo.log.
¡Espero que esto trabaje para usted!

"Jorge Gallardo" <jo***********@eb4enn.com> wrote in message news:<c1**********@nsnmrro2-gest.nuria.telefonica-data.net>...
Hola de nuevo a todos...
Agradecido a todos los que me habeis solucionado problemas anteriores...

Nov 12 '05 #2
Muchas gracias por la documentacion.
Voy a ver si me sirve...
Muchas gracias...
"Dave O" <Cy******@yahoo.com> escribió en el mensaje
news:74**************************@posting.google.c om...
Saludos de Virginia, los E.E.U.U., cerca de la C.C. de Washington.

Aparece que sus archivos de TXT contienen retornos del carro. Usted
puede evitar esto revisando el código que genera el archivo de
"Cabrillo.log".

El código debe evaluar cada línea que venga de los archivos
originales, y escribe esa línea a Cabrillo.log solamente si no
contiene avance de línea o retorno del carro.

El equivalente del avance de línea es "Chr(10)", y el equivalente de
un retorno del carro es "Chr(13)". El código pudo parecer esto:

Open CurrentProject.Path & "\Cabrillo.log" For Append As #1
Open CurrentProject.Path & "\CaDat.txt" For Input As #2
Open CurrentProject.Path & "\Ca.txt" For Input As #3
Open CurrentProject.Path & "\CaEnd.txt" For Input As #4

cadena = Input(LOF(2), #2)
if Trim(Cadena) <> Chr(13) and Left(Trim(Cadena),1) <> Chr(10) then
Print #1, cadena

cadena = Input(LOF(3), #3)
if Trim(Cadena) <> Chr(13) and Left(Trim(Cadena),1) <> Chr(10) then
Print #1, cadena

cadena = Input(LOF(4), #4)
if Trim(Cadena) <> Chr(13) and Left(Trim(Cadena),1) <> Chr(10) then
Print #1, cadena

Esto debe quitar linefeeds y retornos del carro de Cabrillo.log.
¡Espero que esto trabaje para usted!

"Jorge Gallardo" <jo***********@eb4enn.com> wrote in message

news:<c1**********@nsnmrro2-gest.nuria.telefonica-data.net>...
Hola de nuevo a todos...
Agradecido a todos los que me habeis solucionado problemas anteriores...

Nov 12 '05 #3
Usted es absolutamente agradable. Éntreme en contacto con por favor si
usted tiene dificultades adicionales.
"Jorge Gallardo" <jo***********@eb4enn.com> wrote in message news:<c1**********@nsnmrro2-gest.nuria.telefonica-data.net>...
Muchas gracias por la documentacion.
Voy a ver si me sirve...
Muchas gracias...

Nov 12 '05 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Lorenzo Villari | last post by:
Ahem... I think I've found a typo on my copy of The C Programming Language Second Edition. On section 1.9 (page 32 on my version, the Italian one ) you do find: #include <stdio.h> #define...
0
by: Santiago Cassina | last post by:
Hi list. I just want to send to you an sql file containing tools for audit the UPDATE and DELETE statements in a database by saving all the modifications made by a network/system/database user. I...
1
by: Sebastian Bassi | last post by:
Hola, Aca con una pregunta basica: A veces veo que hay programas que tienen varias instrucciones en la misma linea, cuando lo que aprendi de Python era que se usaba el espaciado para mantener...
7
by: Olaf \El Blanco\ | last post by:
/* It look for a last name... That's work OK. If 'del' is 1, after search it will delete I want to put the field valid at NOT_VALID but even fwrite return 1, it never copy anything */ void...
1
by: Mario Lacunza | last post by:
--------- Mensaje reenviado -------- De: Mario Lacunza <mario.lacunza@gmail.com> Para: Lista Python Ing <python-list@python.org> Asunto: Problems with PyGridTableBase Fecha: Sat, 09 Sep 2006...
7
by: leiño | last post by:
Hi, i am adding table rows dynamically with javascript. This works fine. The table is inside a div with scrolls, initially with 6 rows: ..... <div style='overflow:auto; width:100%;...
1
by: DiegoP | last post by:
I've written the folowing code (using the ArraySet class ive created which is sort of like an array with extra methods): when I use the first time the filereader there is no problem, but the time I...
4
by: cplusplusquestion | last post by:
I have a binary file like: a bla bla bla bla b 12 23 34 80 38 a bla bla bla bla b 23 45 89 30 99 When I find first character of the line is 'a', I would like to skip reading this line,...
4
by: felipebucaram | last post by:
Hi, I have a combobox named "combo7", I have 3 problems to resolve. First, I need the user to be able to add items to the combobox from the userform. Second, I need the combobox to autocomplete...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.