would like to modify this command in such a way that I can also pass let's say three string vars (could they also be regexp's?), and at the completion of the modified command it will return 3 counts (one per passed var) each count will tell me how many of the records contained var1 or var2 or var3
Would you really write a KSH script this complicated as a one-liner?
No.
Make your oneliner start with perl -MO=Deparse, and use the output as the basis of a perl program