Hi Greg.
Its easy, just take:
#############################################
#!/usr/bin/perl
$file = "logfile";
$file_tmp ="tmp";
$a = "DSL";
$b="No such user";
open (INPUT, $file) || die ("Could not open file: $!\n");
open (OUTPUT, " > $file_tmp" ) || die ("Could not open file: $!\n");
while (<INPUT>) {
if (!($_ =~/$a/ && $_ =~/$b/)) {
print OUTPUT ("$_");
}
}
close( INPUT);
close(OUTPUT);
rename ($file_tmp, $file) ;
#####################################
Regards from Switzerland
Susanne
> -----Urspr�ngliche Nachricht-----
> Von: Greg Schiedler [SMTP:[EMAIL PROTECTED]
> Gesendet am: Mittwoch, 30. M�rz 2005 08:47
> An: [email protected]
> Betreff: Text Search/Delete
>
> OK I need to parse a rather large logfile and delete specific lines.
> The file is called logfile and is simply a large text file.
>
> Is there some simple way to read in the file and delete specific lines
> that contain DSL:[EMAIL PROTECTED] and the rerun the process to delete
> [EMAIL PROTECTED] -or-
> Delete all lines that contain: "DSL:" and the text :No such user"
>
> Greg
>
>
> Sample logfile....
>
> Wed Jan 5 05:35:57 2005: DSL:[EMAIL PROTECTED]::POP::No such user
> ....
> ....
> Sat Mar 26 08:54:04 2005: DSL:[EMAIL PROTECTED]::POP::No such user
> Sat Mar 26 08:54:10 2005: DSL:[EMAIL PROTECTED]::POP::No such user
> Sat Mar 26 08:54:16 2005: DSL:[EMAIL PROTECTED]::POP::No such user
> Sat Mar 26 08:54:23 2005: DSL:[EMAIL PROTECTED]::POP::No such user
> Sat Mar 26 08:54:29 2005: DSL:[EMAIL PROTECTED]::POP::No such user
> Sat Mar 26 08:54:35 2005: DSL:[EMAIL PROTECTED]::POP::No such user
> ...
> ...
>
>
> --
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> <http://learn.perl.org/> <http://learn.perl.org/first-response>
>
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>