Hello Everyone ,
I have two files. I want to pick line from file-1 and match with the complete data in file-2 , if there is a match print all the match lines in file 3. Below is the file
cat test1.txt
vikas
vikasjain
j ain
testt
douknow
hello@vik@
# 33
||@@ vcpzxcmvhvdsh
dsfdvfdbsvfds judfdsjgfds
cat test2.txt
vik
ain
j ain123
estt
douknow
hello@vik@
vikasjainvikasjain
This is my shell script
cat compare3.sh
#!/bin/ksh
file="test1.txt"
while read line
do
egrep '$line' ./test2.txt >> match_vikas_new.txt
done <"$file"
I have trying to get this working but no luck. Apprcieate if you could guide me on this!