Hello,
While working on the previous script, I encountered a new problem. Given a file ("termlist.txt" and an inputfile ("textfile.txt" --> one sentence = one line), I need to write a script that states:
If a pattern in sentence X of "textfile.txt" matches a term in file "termlist.txt", print that sentence X to new file ("newfile.txt". The problem however is the fact that a term can consist of more than one word. Hopefully, the examples will show you what I want to do.
Given "textfile.txt":
John went to the local pub
He saw a man sitting in the corner
The man gave him a chair
John drank a pint
He paid his drink, the value added tax included, and got out
Given "termlist.txt":
local pub
drink
value added tax
Gawk should only select:
John went to the LOCAL PUB
He paid his DRINK, the VALUE ADDED TAX included, and got out
The patterns need to be marked in the text as well. Can someone help me with this? Thanks,
Jupiler
While working on the previous script, I encountered a new problem. Given a file ("termlist.txt" and an inputfile ("textfile.txt" --> one sentence = one line), I need to write a script that states:
If a pattern in sentence X of "textfile.txt" matches a term in file "termlist.txt", print that sentence X to new file ("newfile.txt". The problem however is the fact that a term can consist of more than one word. Hopefully, the examples will show you what I want to do.
Given "textfile.txt":
John went to the local pub
He saw a man sitting in the corner
The man gave him a chair
John drank a pint
He paid his drink, the value added tax included, and got out
Given "termlist.txt":
local pub
drink
value added tax
Gawk should only select:
John went to the LOCAL PUB
He paid his DRINK, the VALUE ADDED TAX included, and got out
The patterns need to be marked in the text as well. Can someone help me with this? Thanks,
Jupiler