I have two sorted arrays list1=( a b c d) list2=( a b d)
Suppose list1 is a constant list and list2 is created during script execution. I want to compare list2 elements with list1 and discard only those values from list2 which are not there in list1.
Example: if list2=(a b d e f), then I should update list2 as list2=(a b)as (d e f) isn't there in list1.