I want to compare two strings using awk dynamically without trimming the spaces and want to find the count of matching string.
Input Strings file:
File1 content (file1):
" a "
" a2 "
File2 content (file2):
" a "
" a "
" a2 "
" b2 "
" c2 "
Please correct the following code i want exact string matching and not similar matching without trimming the spaces.
while read uid
do
{
cn=`cat file2 | awk -v k=$uid '$1 ~ k' |wc -l`
if [ $cn -ge 1 ]
then
echo "String and count=$uid $cn"
fi
}
done < file1
:wall: