Let's say I have an input file "inputF." In this file we have:

I 2 3 4 5 2
W 3 40 0 3 1 2 3
D 4 59 3 2 9 94 94 220
P 0 0 0 2 1 3 6
Q 3 4 2

U 9 3 2 3
R 9 3 2 1 3 4
W 39 9 0 2 1 1 3
D 3 1 32 3 4 5 91 9
Q 9 2 1

For example...
Now, let's say that I want to print everything that happens after W and before Q in ONLY one case (I would want to print D and P, as in the first case, or just D, as in the second), but I don't necessarily know what's happening in between those letters (I have a defined list of variables to work with, but I have no idea how the actual inputF file will arrange them - they can be in a completely random order). So, basically, I know that I want to print everything that happens between W and Q, but I don't know what's actually between W and Q, or how many lines of text there are between the two letters.

Thanks!