Vlookup and remove line

Ignore list

test_1*
test_2
test_5

Source file

i need to remove test_1_buddy
i need to remove test_1_buddy2
i need to remove test_1
i need to keep_test_10
i need to keep_test_11
i need to remove test_5
i need to remove test_2

Is there any what i remove without using for loop

Why are you putting a condition on the requested solution?
Whenever I see a conditional rule, I assume the request is homework.

1 Like
grep -E -v -f ignore_list source_file

ignore_list file:

test_1([^0-9]|$)
test_2
test_5
1 Like

Thanks i was able to resolve my need buy using this

grep -v -f /root/scripts/exclude_list.txt /var/log/source.log