sean finney wrote:
i invite someone to invent a better way, i'd like to hear it :)
Rather than invoke awk twice, just use awk for everything (-: (I used $DISPLAY for testing) w | awk "\$3 ~ /$DISPLAY/ {print \$1; exit 0}" Note the escaped '$'s.