file1 contains many numbers like shown below:345656565465783329439432345656565465783329439432.......file2:345656565465;ram;dfdfdf54532fdf;...............................783329439432;sam;dfsdgg543546fg;...............................768737228732;bheem;dfsdg5465464767g;...........................34565656546575;hema;jsdsds45345455h;..........................Desired Output: file1 should search the map in file2 and put in file3 (output) like this:345656565465;ram;dfdfdf54532fdf;...............................783329439432;sam;dfsdgg543546fg;...............................So far, I've tried this: $ awk -F'|' 'NR==FNR{c[$1$2]++;next};c[$1$2] > 0' file2 file1Also tried using perl but I'm not sure if this is correct or not since it's not giving me my desired output:perl -e 'open(A, file2); while(<A>){/.+?\|[^|]+/ && $k{$&}++};while(<>){/.+?\|[^|]+/ && do{print if defined($k{$&})}}' file1The problems I am facing with is that it should grep only that number but in my codes it is taking the big-number which consists the same pattern and it should paste in third file. please help me to achieve this :)
comparing the numbers and collecting details and providing output to new file
shell script;regular expression;perl