#!/usr/local/bin/perl -w # ------------------------------------------------------- # ted pedersen # 01/22/01 # # this is a very simple key word in context program # it will extract every line (NOT sentence) from any # number of input files that contains a given word. # # the matching is case in-sensitive and must be exact # e.g., if the word is 'cat' then a line containing # 'cats' or 'catalog' will not be displayed. # ------------------------------------------------------- ($word, @files) = @ARGV; foreach $file (@files) { open(FILE,"$file"); while () { if (/\b$word\b/i) { print; } } }