'netstat' info on Solaris

Hello All

I just wanted to know if on solaris ,below two commands need to be run separately unlike AIX where "/usr/bin/netstat -an -f inet " gives tcp as well as udp info.

/usr/bin/netstat -an -f inet -P tcp
/usr/bin/netstat -an -f inet -P udp

Also is there any way i can make these two commands effectively one and use it ? I do not wish to use 2 separate commands.

Regards
Abhi

not according to the 'man' pages.
Why cannot you use 2 commands?

I am using these commands in a fingerprinting tool and this tool would work only on one command at a time.

My code works fine for AIX and Linux but for Solaris i am stuck due to two separate commands.

Regards
Abhi

Then check for the OS (man uname) and implement accordingly.

We know "/usr/bin/netstat -an -f inet" gives all the data but it has diffrent formats of displaying reports for TCP and UDP.

Its certainly a tricky need.

did you try install wireshark

and then filter TCP and UDP

CaptureFilters - The Wireshark Wiki

Just create a shell script that call both of them sequentially and run that single script.

Wish i could use script somehow but it the tool i use accepts commands only...!!

Regards
Abhi

What prevents you to install that script as a custom command ?

the tool itself ..!!

whatver columns this command gives,i need to create those many workspaces (place i would write logic to capture data from this command) and tool would generate a CSV comprising of these columns....

Regards
Abhi

If you are talking about these commands output format, nothing prevents you to reformat it to suit your tool. If I'm missing something, please elaborate on the restrictions your tool have.