I have a file1 with approx 60000 lines, And a file2 with approx 20000 lines. I need to delete the lines present in file2 from file1. File2 also contains .* to delete the similar pattern from file1.
file1:
ABC DEG
bhdh jdjjd
cdhhd jdjd
ABC hjj
file2:
ABC.*
cdhhd jdjd
Output should be:
bhdh jdjjd
Right now, I am using the below code.
while read -r line
do
sed -i "/${line}/d" $file1
done < "$file2"
With this code, it's taking around 30 mins to get the output. I really need a better way to delete those lines from file1.