Hi, all
I have been trying to find a way to pass parameters into regular expression, failed, so I am back.
for example, I have following two files:
# firstfile
USA US United_States_of_America
# secondfile
x company USA
US y Company
xyz United_States_of_America
what I want is to pass every key in the firstfile to regular expression, and then loop through the second file.
like this:
## code below ###
for x in firstfile
do
awk -v reg=$x '/reg/' secondfile
done
However, this won't work, can anyone suggest how to solve this?
Thanks
will
I have been trying to find a way to pass parameters into regular expression, failed, so I am back.
for example, I have following two files:
# firstfile
USA US United_States_of_America
# secondfile
x company USA
US y Company
xyz United_States_of_America
what I want is to pass every key in the firstfile to regular expression, and then loop through the second file.
like this:
## code below ###
for x in firstfile
do
awk -v reg=$x '/reg/' secondfile
done
However, this won't work, can anyone suggest how to solve this?
Thanks
will