473,748 Members | 8,530 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 SALIDAHACIATEXT O, 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_E rr
Dim Retval
Call Cabrillo
Retval = Shell("notepad. exe " & CurrentProject. Path & "\Cabrillo.log" ,
vbMaximizedFocu s)
EtiquetaError_E xit:
Exit Sub
EtiquetaError_E rr:
MsgBox Error$
Resume EtiquetaError_E xit
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 16094
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.l og".

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(Caden a),1) <> Chr(10) then
Print #1, cadena

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

cadena = Input(LOF(4), #4)
if Trim(Cadena) <> Chr(13) and Left(Trim(Caden a),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.tele fonica-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.goo gle.com...
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.l og".

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(Caden a),1) <> Chr(10) then
Print #1, cadena

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

cadena = Input(LOF(4), #4)
if Trim(Cadena) <> Chr(13) and Left(Trim(Caden a),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.tele fonica-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.tele fonica-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
1899
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 MAXLINE 1000 /* lunghezza massima di una linea */ int getline(char line, int maxline); void copy(char to, char from);
0
2743
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 hope you find it useful El Santi =====
1
1466
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 la estructura (indent). Por ejemplo: if name != 'comic': return Hay un return despues de los dos puntos, no se que significa.
7
2781
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 Search_Delete(FILE *file_pupils, int del) { char option;
1
1764
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 00:03:20 -0500 Hello, I attach two files:frmClientes and frmClientesNE.
7
13561
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%; height:100;'> <table> <tr><td>nothing</tr></td> <tr><td>nothing</tr></td>
1
1181
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 use the second one on it reads the first line and keeps printing. Ive tried using only the second filereader puting a break at the end of the while, etc. and nothing has worked to stop it. Please help! import java.io.*; import java.util.*; ...
4
1614
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, then go to next line. Any suggestion?
4
2363
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 when the user writes something similar. Third, I need the user to be able to select multiple items from the combobox. Fourth, I need it to be syncronized to other comboboxes, so that they all contain always the same information, even if someone add a...
0
8989
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9537
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9367
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9319
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8241
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6795
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6073
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4869
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
3
2213
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.