Hi all,
I have a file containing a list of words, one word per line, eg:
france
germany
usa
england
I want to count the occurrences of each of these words in another file. At the moment though I can't even get the awk script to find any of the words, let alone their count.
This is my shell script:
#!/bin/sh
cat words | \
while read line
do
awk '/$line/{print $line}' report.txt
done
i thought that this would print out the matching word if it was found within the file reports.txt but nothing is ever printed out, where am I going wrong?
Many thanks for your help.
I have a file containing a list of words, one word per line, eg:
france
germany
usa
england
I want to count the occurrences of each of these words in another file. At the moment though I can't even get the awk script to find any of the words, let alone their count.
This is my shell script:
#!/bin/sh
cat words | \
while read line
do
awk '/$line/{print $line}' report.txt
done
i thought that this would print out the matching word if it was found within the file reports.txt but nothing is ever printed out, where am I going wrong?
Many thanks for your help.