The best solution is to write an X-Motif C program that uses XtGetSelectionValue. That will work on any window. But I will be lazy and use xprop. This works on all hpterm and xterm windows. For most everyday tasks, this is enough.
Many more variations are available.
So I will use functions for those aliases that require arguments. This was not necessary in csh. Yitshak Merin is a systems engineer at the HP-UX Response Center in Tel Aviv, Israel. He has been working on various UNIX platforms for 10 years, developing software and administrating systems. Copyright 2001 Interex.