Hi to all, I need to delete in a list of files, and in each file of newsgroups, all the posts which contents quoted lines. ONLY IF these lines are effectively repeating the non quoted text. I'm actually working on a single file in the directory, but the moment in which I have to work on a multi-file directory is approaching to me, and I'm not able to make works two files in the same time.
I create a file (the control-file) in which there are stored all the quoted lines.
I open the control-file then I verify if each quoted line is repeating
other text.
If a line is doing it, I delete all the post.
---------------under this line the script----------------------------
#!/usr/bin/perl -w
use strict; my ($temp,$actual,$var); my $del = 0;
my $fileName = "/Users/pes/Desktop/TC4ctrl/test2.txt"; open (INPUT, $fileName) or die "File not opnd cos $!"; my $control = <INPUT>; close(INPUT); $^I = '';
@ARGV = </Users/pes/Desktop/TC4/*.txt>; while(<>){ # if it's the end of a post... if (/={8}/g) { # ... the script knows if it must print the entire post... if ($del == 0) { $temp .= "\n========\n"; print $temp; $temp = ""; } # ... or if it must delete it else { $temp = ""; $del = 0; } } # if there's a quoted line it compare the line without quoting # with all the line in the control files # in my intentions when there's the first repetition it decide # set the erasure-variable $del to 1 ("yes, delete it!") and continue # the while cycle...... this block does not work elsif (/^>/g) { $actual = $=B4; while ($control) { $del = ($control =~ /$actual/m); next; } } else { $temp .= $_; } print STDOUT ++$var, " - I cleaned $ARGV\n" if (eof); } print "Done!\n"; ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
thank you all
all'adr
-- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]