Well, what about reading all lines into an array, do a grep on it and then
work further ?
open(FILE,"file.data");
@array = <FILE>;
close FILE;
@array = grep(/string_to_search/i,@array);
foreach(@array){
$_ =~ s/(string_to_search)/&highlight($1)/ieg; # Get string again and do
perform the highlight code on it...
print $_;
}
exit;
Well, I didn't test this code, just wrote it here in my mail client, but I
guess it should work. Of course if your highlighting only means put
between <B> tags (for HTML), you could do it without subroutine.
Good luck,
Thomas
On Tue, 2 Apr 2002, Eelco Alosery wrote:
> I want to search tru a file named test.file
> In this file thera are about 20 lines, ordert
> first name, last name, adres, info
>
> I want to type a word wich is not case sensetif, and then search tru the
> file.
> if there is a match, the word must be hylited, and the line in wish the word
> is found must be printed to.
>
> can somewane help me
>
>
>