=o

>>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


   >Well, what about reading all lines into an array, do a grep on it and then
work further ?<<

To slurp in one big file into an array might explode the memory. Read
one line at a time works fine for big files as well.


Jau kans dat so maken (TIMTOWToDI) (tested and passed!):
=cut

################################################
$Suchwort = "Kaaskopp";

open D_E, "testfile.dat" or die "Niet funden";
open D_A, ">testfile.dat u" or die "Dat geiht niet";

for $_(<D_E>) {
  if (not s,$Suchwort,<b>$Suchwort</b>,ig) { next }
  print;
  print D_A $_;  }

print "\nf e r t i g !";
############################################


=Testfile.dat:

Marie Mojens Kaaskoppel 24 Maastricht
Karsten Kaaskopp Kantendijk Klockengracht 22
xxxxx xxxxxxxxx xxxxxxx xxxxxxx xxxxx
yyyyyyyyy yyyyyyyyy yyyyyyyyyyyyy yyyyyyy


Utgaav:

Marie Mojens <b>Kaaskopp</b>el 24 Maastricht
Karsten <b>Kaaskopp</b> Kantendijk Klockengracht 22

f e r t i g !



Reply via email to