This a rather contrived situation, but it illustrates the point that you write the regex test to match your goal and the data; there is no catch-all regex
. So, in this case you'd want to do:
awk -F';' '{ if ($1 ~/^Test$/) print $0 }' myFile
I'm not sure if you're familiar with ^ and $, so I'll explain them anyway. ^ and $ are anchors. ^ indicates that you want to match "at the beginning of the input". So, "^cat" matches the text "cat" and "catherine", but not "fatcat" or " cat".
$ works similarily, but it means match "at the end of the input". So, "cat$" will match "cat" and "fatcat", but not "catherine" or "catcatcatt".
As you can see, I used them together in fixing your regex above. Now it only matches if the text is exactly "Test".
HTH
p.s. I'm not sure on the history of the tilde's (~) use in regexes, but generally it means "approximately". Perhaps it's just a convenient way of making it clear that we're dealing with regexes?
(syntactic sugar?)
p.p.s the poster above points out another useful construct in regexes. Note, though, that it will also match lines containing multiple words, with "Test" being one of them (eg. the line "monkey Test zappa;fish" will match also). That may work just as well as my solution
. But in more complicated situations you'd probably have to choose one or the other (or something completely different).