Hola de Taburiente.
Te hice un ejemplo muy simplificado que hace lo que buscas.
Código Delphi
[-]
procedure GenerarArchivos(const Ruta: string; const Nombre: string);
const
SEPARADOR = ' ';
var
Origen, Destino: TextFile;
Linea: string;
begin
AssignFile(Origen, Ruta + Nombre);
AssignFile(Destino, Ruta + 'DESTINO.KCL');
Reset(Origen);
Rewrite(Destino);
try
while not Eof(Origen) do
begin
Readln(Origen, Linea);
Writeln(Destino,Copy(Linea,17,9) + SEPARADOR + Copy(Linea,36,MaxInt));
end
finally
CloseFile(Origen);
CloseFile(Destino);
end;
end;
Llamada de prueba:
Código Delphi
[-]
GenerarArchivos('C:\TEMP\','ORIGEN.TXT');
Archivo origen (ORIGEN.TXT):
Código:
#MSG_3 L_CODE 7 193407869 4e7b50cb 22/09/2011_17:14:00
#MSG_5 L_CODE 9 193418949 4e7b50cf 22/09/2011_17:14:00
#MSG_6 L_CODE 8 193409660 4e7b50d2 22/09/2011_17:14:00
Resultado (DESTINO.KCL):
Código:
193407869 22/09/2011_17:14:00
193418949 22/09/2011_17:14:00
193409660 22/09/2011_17:14:00
Tendrías que hacer algunos ajustes como las rutas y nombres de archivo que correspondan a tu caso y la cantidad de espacios que deseas que tenga la constante
SEPARADOR.
Un saludo.