HI,
I would like to grep patterns in "file_1.txt" which has the format below, in the file "original.txt" i.e I would like to see if patterns in "file_1.txt" does exist in "original.txt"
#cat file_1.txt
/fs10/my_design
/fs12/schematics
/fs36/optimization
/fs20/shark
#cat original.txt
/fs10/my_design
/fs34/my_Circuits
/fs12/schematics
/fs15/layouts
I wrote a script to check if the patterns in file_1.txt does actually exist in original.txt:
#cat myscript.sh
for i in `cat file_1.txt`
do
cat original.txt|grep $i|tee -a foundPatterns.txt
done
Unfortunately, it does not grep the patterns in "file_1.txt" out from the file "original.txt" although it does exist.
However, when I did a:
#grep "/fs10/my_design" original.txt
/fs10/my_design
it then prints the contents in "original.txt" which matches the pattern specified.
Could someone show me how the script should have been written?
Thanks.