Ver Mensaje Individual
  #1  
Antiguo 24-10-2007
yue20023 yue20023 is offline
Registrado
 
Registrado: jul 2006
Posts: 2
Reputación: 0
yue20023 Va por buen camino
Exclamation ayuda con un txt

tengo una aplicacion que elabore y me deja limpiar archivos txt el problema es que quiero que no me borre 2 lineas y no puendo encontrar la solucion el archivo original es el siguiente


http://usuarios.lycos.es/yuehang/Copia de uv8922304275aa.txt

quiero dejar la linea en donde dice oficinas y la linea en donde dice siniestro pero no me queda mi codigo es el siguiente :

Código Delphi [-]
unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Label1: TLabel;
    Button1: TButton;
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.Button1Click(Sender: TObject);
var
  fsarchivoaleer : TextFile;
  fsarchivosalida :TextFile;
  s,s1:string;
begin
  if fileExists(Edit1.Text) then begin
    AssignFile(fsarchivoaleer,Edit1.Text);
    rReset(fsarchivoaleer);
    AssignFile(fsarchivosalida,Edit1.Text+'o');
    Rewrite(fsarchivosalida);
    while not eof(fsarchivoaleer) do begin
      readln(fsarchivoaleer,s);
        if length(trim(s))>0 then begin
        if s[1] in ['O','-','_','S'] then begin
          s:=''
        end else begin
          if s[1]='0' then begin
            if length(trim(s1))>0 then
              writeln(fsarchivosalida,s1);
            s1 := s;
          end else
          if s[1]<> '-' then begin
            if s[1]='R' then begin
                if s[67]='' then
                  s := copy(s,1,66);
                s1 := s1+' '+s;
            end;
          end else
          if s[64] in ['0','1','2','3','4','5','6','7','8','9'] then
            s1 := s1+ ' '+ copy(s,62,67);
        end;

      end;
    end;
    CloseFile(fsarchivosalida);
    CloseFile(fsarchivoaleer);
  end;

end;

end.

por favor ayudenmeeeeeeeee!!!!!!!!!!
Responder Con Cita