Hi All,
I have a big file which looks like this:
abc 34.32
cdf 343.45
computer 1.34
ladder 2.3422
I have some 100000 .TXT files which look like this:
computer
cdf
align
I have to open each of the text files and read the words from the text files. Then I have to look into that dictionary for the occurrence of the word and copy on the number in 1.num file. This is what I mean:
Contents of 1.num
1.34
343.45
0
As you can see, I have copied the numbers matching with words in 1.txt from that big file. 0 for no-occurrence.
I have to do this for all 100000 .txt files.
I have tried some lookup techniques but not working though.
for txt in *.txt; do
awk '
NR == FNR { a[$1]=$1 }
NR != FNR { print $1, a[$1] }
' big_file.dat $txt >${txt%txt}num
done
I am doing this in Linux with BASH