Hola Taburiente.
Si, ahora creo que está más claro

, fijate si te sirve de este modo:
Código Delphi
[-]
procedure GenerarArchivos(const Ruta: string; const Nombre: string);
const
SEPARADOR = ' ';
var
Origen, Destino: TextFile;
Linea: string;
TS: TStrings;
begin
AssignFile(Origen, Ruta + Nombre);
AssignFile(Destino, Ruta + 'DESTINO.KCL');
Reset(Origen);
Rewrite(Destino);
try
TS:= TstringList.Create;
while not Eof(Origen) do
begin
Readln(Origen, Linea);
if Pos('M_COUNT', Linea) <> 0 then
Writeln(Destino, Linea)
else if Pos('L_CODE', Linea) <> 0 then
begin
TS.Clear;
TS.Delimiter:= ' ';
TS.DelimitedText:= Linea;
Writeln(Destino, TS[3] + SEPARADOR + TS[5]);
end;
end
finally
TS.Free;
CloseFile(Origen);
CloseFile(Destino);
end;
end;
Resultado de la prueba:
ORIGEN.TXT
Código:
#MSG_1 M_COUNT 50_JAZZ_PAGO11M15_12C3DS1_PP001_a00_afp TT14 GD0 BM0 BC0 DB0 EJ0 INS0 DEL0 22/09/2011_17:14:00
#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
#MSG_7 L_CODE 12 193305710 4e7b50d4 22/09/2011_17:14:00
#MSG_9 L_CODE 13 193410268 4e7b50d8 22/09/2011_17:14:00
#MSG_10 L_CODE 14 193409560 4e7b50db 22/09/2011_17:14:00
#MSG_11 L_ERROR 14 DOUBLE 193409560 4e7b50df 22/09/2011_17:14:00
#MSG_12 M_ACT STOP_MACHINE 1 50_JAZZTEL_PAGO11M15_12C3DS1_PP001_a00_afp 4e7b50df 22/09/2011_17:14:00
#MSG_14 L_ERROR 10 BAD_IMAGE 4e7b50e7 22/09/2011_17:14:00
#MSG_15 M_ACT STOP_MACHINE 1 50_JAZZTEL_PAGO11M15_12C3DS1_PP001_a00_afp 4e7b50e7 22/09/2011_17:14:00
#MSG_16 L_ERROR 10 BAD_IMAGE 4e7b50e8 22/09/2011_17:14:00
#MSG_17 M_ACT STOP_MACHINE 1 50_JAZZTEL_PAGO11M15_12C3DS1_PP001_a00_afp 4e7b50e8 22/09/2011_17:14:00
#MSG_19 L_CODE 10 193409476 4e7b50ed 22/09/2011_17:14:00
#MSG_21 M_COUNT 50_JAZZ_PAGO11M15_12C3DS1_PP001_a00_afp TT14 GD7 BM2 BC0 DB1 EJ0 INS0 DEL0 22/09/2011_17:15:00
DESTINO.KCL
Código:
#MSG_1 M_COUNT 50_JAZZ_PAGO11M15_12C3DS1_PP001_a00_afp TT14 GD0 BM0 BC0 DB0 EJ0 INS0 DEL0 22/09/2011_17:14:00
193407869 22/09/2011_17:14:00
193418949 22/09/2011_17:14:00
193409660 22/09/2011_17:14:00
193305710 22/09/2011_17:14:00
193410268 22/09/2011_17:14:00
193409560 22/09/2011_17:14:00
193409476 22/09/2011_17:14:00
#MSG_21 M_COUNT 50_JAZZ_PAGO11M15_12C3DS1_PP001_a00_afp TT14 GD7 BM2 BC0 DB1 EJ0 INS0 DEL0 22/09/2011_17:15:00
Saludos.