- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: netstat -a | grep
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Discussions
Forums
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2006 07:45 AM
тАО09-12-2006 07:45 AM
netstat -a | grep
I want to netstat -a | grep '23' (or any port number).
I dont want output to contain
6523 or
6723
I want output to contain
23 or
25 etc
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2006 07:48 AM
тАО09-12-2006 07:48 AM
Re: netstat -a | grep
try:
netstat -a | grep " 23"
or
netstat -a | grep ":23"
putting a space in the quotes gets rid of 6523
SEP
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2006 07:49 AM
тАО09-12-2006 07:49 AM
Re: netstat -a | grep
You can restrict by
# netstat -a |grep "23"
-Arun
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2006 07:51 AM
тАО09-12-2006 07:51 AM
Re: netstat -a | grep
netstat -an | grep '.23 '
note the -an says do not perform a name lookup (otherwise, 23 will be translated to telnet and will never show up) and note that there is a period before the 23 and a space after the 23.
you might also want to consider using lsof (download it if you dont already have it)
lsof -i :23
Hope this helps.
Kofi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2006 07:52 AM
тАО09-12-2006 07:52 AM
Re: netstat -a | grep
If you do a grep -w 23 it will search for 23 as a word by itself.
netstat -a | grep -w 23
HTH
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2006 07:52 AM
тАО09-12-2006 07:52 AM
Re: netstat -a | grep
Use: netstat -a | grep ".23"
Regards,
MB.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2006 07:54 AM
тАО09-12-2006 07:54 AM
Re: netstat -a | grep
# netstat -a|perl -nae 'print if $F[3]=~/\.23/'
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2006 07:54 AM
тАО09-12-2006 07:54 AM
Re: netstat -a | grep
netstat -an | grep -E -e '\.23 '
Note the '\.' rather than '.'. In Regular Expressions, '.' represents any character so we need to explicitly look for the '.' and thus we need to escape the '.' with a backslash.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2006 07:56 AM
тАО09-12-2006 07:56 AM
Re: netstat -a | grep
# netstat -an | grep -E '.+\..+\..+\..+\.23 |\*.23 '
PCS
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2006 07:56 AM
тАО09-12-2006 07:56 AM
Re: netstat -a | grep
If you escape the . (ie. grep "\.23" that will make grep search for a period, but will still include ports that start with 23 (ie. 2301, 239, etc.)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО09-12-2006 07:56 AM
тАО09-12-2006 07:56 AM
Re: netstat -a | grep
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО10-11-2006 11:07 PM
тАО10-11-2006 11:07 PM