I’m trying to write my first script to search for a given pattern in text file named test. Here is the script:
#! /bin/csh
echo -n "enter pattern: "
set pattern = $<
foreach word (`cat test`)
echo $word | egrep $pattern
end
When I try to run it I get the message foreach: No match found. I suspect the problem is caused by (cat test
). Any help would be much appreciated.