linux - Shell Script to find string of file A in File B and print Yes or No in front of particular string -


i have 2 file & b. file contains strings. wanted find strings in file b & if string there in file b. print yes in front of string in file otherwise print no.

propose solution.

something that:

#!/bin/bash  while read -r searchpattern;         if grep -q "$searchpattern" fileb;         flag="yes"     else         flag="no"         fi     printf "%s %s\n" "$flag" "$searchpattern" done < filea >output 

Comments