Linux.com

do it in one line with awk, no tmp file needed

Posted by: Anonymous [ip: 172.16.176.1] on October 09, 2007 01:08 AM
lsof | grep /usr/apps/payroll | awk '{print $2}' | uniq | awk '{print "netstat -p | grep "$1}' | sh | awk '{print $5'} | awk -F: '{print $1}'


or alternatively:


lsof | awk '$0~/\/usr\/apps\/payroll/{print $0}' | awk '{print $2}' | uniq | awk '{print "netstat -p | grep "$1}' | sh | awk '{print $5'} | awk -F: '{print $1}'
[Modified by: Anonymous on October 10, 2007 04:31 AM]

#

Return to A script to tell which workstations are using Samba shares