@_maldini_ - we are all going around trying to guess what output you are looking for.
It is obvious that you want to flag drugs and/or groups of drugs, analyzing the text in rxsublist variable.
Can you design and give some examples of output desired per input string ?
For example, what output would you like for:
Line rxsublist
11 Effexor , Amytriptyline, Metformin, Valuim, Flomax
15 Depression Pills
36 i have used cannabis as a substitute for mild pain medicine like vicodin.
49 pain relievers
73 Painkillers like Paracetamol for headaches and such
Do you have a list of drugs and their categories in a file that can use as second input,
to create a format like @Patrick offered ?