I need to extract a portion of text from a text file log.txt, where the contents of the file are as follows.
SESSIONNAME USERNAME ID STATE TYPE DEVICE
services 0 Disc
console 1 Conn
input1 3 Disc
rdp-tcp#0 input2 4 Active rdpwd
input3 6 Disc
rdp-tcp 65536 Listen
Specifically, I need the SESSION ID of a specific username. Need help in extracting the same. Any advice or help will be much appreciated.
Thanks.
qwinsta
with the username as a parameter.