Help required - lsof in AIX


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Help required - lsof in AIX
# 1  
Old 03-17-2012
Question Help required - lsof in AIX

Hi All,

Output of the following command is ok so far ...

netstat -an | grep 192.168.156.1.16507 | awk '{print $5}' | awk '{FS="."} {print $5}'

1297
1350
1394
1211
1255
1259
4606
2184
2009
4890
1398
3941
1671
1780
51 [shivalpl1] dbi %


Now I want to redirect those outputs to lsof, but its not working. Suppose if I do it manually like this ...

[shivalpl1] dbi % lsof -iTCP:1297
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
cmddmn 58851632 dbi 10u IPv4 0xf1000e000113ebb0 0t400 TCP shivalpl1:dbi_cmddmn->s37stn6:sdproxy (ESTABLISHED)
52 [shivalpl1] dbi %

So the above looks good, but if I do redirect the putput of the above awk to lsof, its giving error. See the following command ...

[shivalpl1] dbi % netstat -an | grep 192.168.156.1.16507 | awk '{print $5}' | lsof -iTCP:`awk '{FS="."} {print $5}'`
lsof: status error on 1350: No such file or directory
lsof: status error on 1394: No such file or directory
lsof: status error on 2513: No such file or directory
lsof: status error on 3317: No such file or directory
lsof: status error on 1361: No such file or directory
lsof: status error on 2940: No such file or directory
lsof: status error on 2972: No such file or directory
lsof: status error on 3342: No such file or directory
lsof: status error on 3251: No such file or directory
lsof: status error on 1395: No such file or directory
lsof: status error on 2184: No such file or directory
lsof: status error on 4890: No such file or directory
lsof: status error on 2381: No such file or directory
lsof: status error on 1671: No such file or directory
lsof: status error on 1780: No such file or directory
lsof 4.77
latest revision: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/
latest FAQ: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/FAQ
latest man page: ftp://lsof.itap.purdue.edu/pub/tools/unix/lsof/lsof_man
usage: [-?abhlnNoOPRstUvVX] [+|-c c] [+|-d s] [+|-D D] [+|-f[cfgGn]]
[-F [f]] [-g [s]] [-i [i]] [+|-L [l]] [-m m] [+|-M] [-o [o]]
[-p s] [+|-r [t]] [-S [t]] [-T [t]] [-u s] [+|-w] [-x [fl]] [--] [names]
Use the ``-h'' option to get more help information.
[shivalpl1] dbi %


Can anybody give me a hand to resolve this please ?

Regards.
# 2  
Old 03-17-2012
Try if this works for you :
Code:
netstat -an | grep 192.168.156.1.16507 | awk '{print $5}' | awk '{FS="."} {print "lsof -iTCP:"$5}' | sh

Or use for loop (or while read line ) :
Code:
for i in $(netstat -an | grep 192.168.156.1.16507 | awk '{print $5}' | awk '{FS="."} {print $5}')
do
lsof -iTCP:$i
done

This User Gave Thanks to Peasant For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Inputs required in decoding file on AIX- executable (RISC System/6000) or object module not stripped

Hi, We are in the process of migrating from AIX to Linux. There is a script of type "executable (RISC System/6000) or object module not stripped" on AIX and we are unable to read the contents of it. Is there a way to read the contents of the file on AIX, so that we can rewrite the code in... (3 Replies)
Discussion started by: venkatesh17
3 Replies

2. AIX

Redistribution bin required for AIX. j7r164redist.7.1.0.25.bin

Hi, I am planning to install a version of Informatica on my AIX box. It requires a specific java build in pap6470_27sr2-20141101_01(SR2). The current link for IBM 64-bit SDK for AIX®, JavaTM Technology Edition, Version 7 Release 1 has a more recent version in j7r164redist.7.1.0.75.bin. Is... (4 Replies)
Discussion started by: meetpraveens
4 Replies

3. AIX

Information required for AIX certification

Hello friends, I want some information on AIX certification and want to give the AIX certification exam but not getting the proper information required. Basically when I am trying to search the information about this certification getting different options like "AIX p series certification" Aix... (6 Replies)
Discussion started by: naman agarwal
6 Replies

4. AIX

Required AIX Simulator \Command reference book

Sir, Iam required AIx simulator If any send the download link I required it for practice (2 Replies)
Discussion started by: arif185
2 Replies

5. Shell Programming and Scripting

Getting required fields from a test file in required fromat in unix

My data is something like shown below. date1 date2 aaa bbbb ccccc date3 date4 dddd eeeeeee ffffffffff ggggg hh I want the output like this date1date2 aaa eeeeee I serached in the forum but didn't find the exact matching solution. Please help. (7 Replies)
Discussion started by: rdhanek
7 Replies

6. AIX

Help required in analyzing errpt in aix 5.3

I have received errpt like this.Any help will be highly appreciated.Recently my application has been migrated to aix 5.3 and working fine in aix 5.2 with out crashes. LABEL: CORE_DUMP IDENTIFIER: C69F5C9B Date/Time: Thu Apr 23 09:41:29 EDT 2009 Sequence Number: 948... (3 Replies)
Discussion started by: kittu1979
3 Replies

7. UNIX for Dummies Questions & Answers

lsof

I'm looking to list all of the files open at a certain time up on a UNIX box. From looking on the internet, it looks as though lsof is the most common. However have tried this and got the following: ksh: lsof: not found Now having gone into bash mode and hit tab twice I see that lsof... (3 Replies)
Discussion started by: meevagh
3 Replies

8. AIX

IY17981 fix required for aix 4.3.3 to aix 5L migration but not found

Hi, redbook documentation is telling that IY17981 fix is required for aix 4.3.3 to aix 5L migration. But there is no mention about that fix in any ML installation packages. - My system is ML11 : oslevel –r 4330-11 - But xlC.rte is on wrong version : lslpp -L xlC.rte xlC.rte ... (3 Replies)
Discussion started by: astjen
3 Replies

9. AIX

AIX -UNIX lsof

Hi, I am using lsof command to find all open files in our AIX-unix 5.3 server.The o/p looks like this, COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME oracle 372902 cbn cwd VDIR 47,2 4096 4186880 /glotam (/dev/fslv00) But i want to know which are the... (1 Reply)
Discussion started by: gnanadurai_it
1 Replies

10. Filesystems, Disks and Memory

lsof

Could someone please give me a step for a hint on which version and where is the above utility is for version 4.3.3.0 of Aix. (1 Reply)
Discussion started by: jacl
1 Replies
Login or Register to Ask a Question