Suppose u have a file
12
22
73
another file
L22D SSS
S12J LLL
H77K PPP
J25O LOP
I73S lOP
K99O PLO
so output shud like
S12J LLL
L22D SSS
I73S lOP
Thanks
Suppose u have a file
12
22
73
another file
L22D SSS
S12J LLL
H77K PPP
J25O LOP
I73S lOP
K99O PLO
so output shud like
S12J LLL
L22D SSS
I73S lOP
Thanks
#!/bin/sh
# search_these_patterns.sh
pattern_file=$1
another_file=$2
for pattern in `cat $pattern_file`
do
grep $pattern $another_file
done
Run this script as:
sh search_these_patterns.sh pattern_file another_file > new_file
grep -F -f a_file another_file