Hello All,
I have two files on which I have to do "pattern" based matching and need to place the records to "Matched" and "Unmatched" output files respectively.
Here we go:
cat file1
ft , * , *, prem , odacc
ftpr , * ,* , prem , odacc
ft,aa,*,*,odacc
ft,*,*,*,*
*,*,*,odacc
cat file2
abc,*,*,prem,odacc
* , bcd , * , prem , odacc
Now , I have to do a seach from file1 and file2 such that , if the fields in "file1" are equal to "file2" or one of the fields in either of the file is "*" then place the file1 content in to "matched" else in to "unmatched".
Here , "*" is considered as universal acceptance character ( so will be true always irrepsective of the corresponding filed value in other file)
The required outcome from file "matched"
ft , * , *, prem , odacc ## matches with * , bcd , * , prem , odacc from file2
ftpr , * ,* , prem , odacc ## matches with * , bcd , * , prem , odacc from file2
ft,*,*,*,* ## matches with * , bcd , * , prem , odacc from file2
*,*,*,odacc ## matches with * , bcd , * , prem , odacc from file2
from file "Un matched"
ft,aa,*,*,odacc