Hi Everyone
pls if anyone can help me in writing a script or correcting it what I have done.
I want to write a script to grep record number for all those record which have abc xyd cat dog in one of the field say VALUE, I have thousand of file in a dir and I want to search every file for mathching pattern in field VALUE ,I was trying to give path of dir from command prompt.
#!/bin/sh
filePath=$1;
for i in `ls $filepath`
do
for y in `grep -il patternfile $filepath$i`
do
echo "processing file $y"
egrep "<RecordNumber>" $y >>metafile.txt
done
done
My script is not searching in every file in a dir for the multiple pattern which I have saved to a pattern file. Is there a another way to solve the problem . I think I am doing something wrong in looping . It is not searching everyfile in a dir.
pls help me if anyone solve this or figure it out.