- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: shell script
Operating System - Linux
1753857
Members
7621
Online
108809
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
back
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
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Go to solution
Topic Options
- 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
03-31-2008 05:04 PM
03-31-2008 05:04 PM
Hi all.
can I get the proper data from awk?
I'm going to get the 80 port connected from client
netstat -na|grep 80|awk '{print $5}'
the output is
as below
211.230.217.114:13098
221.159.231.39:11257
211.230.217.114:13534
211.230.217.114:13200
222.98.234.60:7370
211.230.217.114:14410
211.230.217.114:13995
222.98.234.60:7195
211.230.217.114:14629
211.237.50.75:80
211.237.50.75:80
211.237.50.75:80
211.237.50.75:80
127.0.0.1:80
127.0.0.1:80
127.0.0.1:80
127.0.0.1:9001
59.4.203.206:5514
211.229.236.56:16304
211.221.23.87:8704
211.221.23.87:7950
211.221.23.87:8250
211.221.23.87:8509
211.221.23.87:8747
211.229.236.56:15751
218.144.122.134:5413
211.221.23.87:9262
211.221.23.87:8281
211.229.236.56:2543
211.221.23.87:8306
211.229.236.56:16323
218.144.122.134:5533
211.221.23.87:8338
222.232.158.138:14598
211.229.236.56:2096
218.144.122.134:5519
218.144.122.134:5506
211.221.23.87:8628
211.237.50.102:80
211.237.50.102:80
211.237.50.102:80
211.221.23.87:8144
211.221.23.87:8668
211.229.236.56:2670
211.221.23.87:8901
211.221.23.87:8649
211.221.23.87:8652
211.221.23.87:8436
211.229.236.56:15951
211.229.236.56:2121
10.10.10.86:1521
211.221.23.87:8681
211.221.23.87:8684
211.230.217.114:14027
220.119.104.171:15816
211.216.214.37:4796
211.230.217.114:13708
211.230.217.114:14498
211.230.217.114:14759
211.230.217.114:14263
211.216.214.37:6944
220.119.104.171:15705
211.230.217.114:13412
211.230.217.114:14184
211.230.217.114:13676
211.230.217.114:13423
211.230.217.114:13937
211.230.217.114:14101
222.98.234.60:7293
211.237.50.80:3385
125.133.237.131:2819
61.78.62.12:4677
61.78.62.12:4683
125.133.237.131:2626
I have 2 problems
1. how to get the uniq ip from output except for duplicated ip
2. how to get the separator ":" from the output
so first field is IP and second field is port
I need your help..!!!
can I get the proper data from awk?
I'm going to get the 80 port connected from client
netstat -na|grep 80|awk '{print $5}'
the output is
as below
211.230.217.114:13098
221.159.231.39:11257
211.230.217.114:13534
211.230.217.114:13200
222.98.234.60:7370
211.230.217.114:14410
211.230.217.114:13995
222.98.234.60:7195
211.230.217.114:14629
211.237.50.75:80
211.237.50.75:80
211.237.50.75:80
211.237.50.75:80
127.0.0.1:80
127.0.0.1:80
127.0.0.1:80
127.0.0.1:9001
59.4.203.206:5514
211.229.236.56:16304
211.221.23.87:8704
211.221.23.87:7950
211.221.23.87:8250
211.221.23.87:8509
211.221.23.87:8747
211.229.236.56:15751
218.144.122.134:5413
211.221.23.87:9262
211.221.23.87:8281
211.229.236.56:2543
211.221.23.87:8306
211.229.236.56:16323
218.144.122.134:5533
211.221.23.87:8338
222.232.158.138:14598
211.229.236.56:2096
218.144.122.134:5519
218.144.122.134:5506
211.221.23.87:8628
211.237.50.102:80
211.237.50.102:80
211.237.50.102:80
211.221.23.87:8144
211.221.23.87:8668
211.229.236.56:2670
211.221.23.87:8901
211.221.23.87:8649
211.221.23.87:8652
211.221.23.87:8436
211.229.236.56:15951
211.229.236.56:2121
10.10.10.86:1521
211.221.23.87:8681
211.221.23.87:8684
211.230.217.114:14027
220.119.104.171:15816
211.216.214.37:4796
211.230.217.114:13708
211.230.217.114:14498
211.230.217.114:14759
211.230.217.114:14263
211.216.214.37:6944
220.119.104.171:15705
211.230.217.114:13412
211.230.217.114:14184
211.230.217.114:13676
211.230.217.114:13423
211.230.217.114:13937
211.230.217.114:14101
222.98.234.60:7293
211.237.50.80:3385
125.133.237.131:2819
61.78.62.12:4677
61.78.62.12:4683
125.133.237.131:2626
I have 2 problems
1. how to get the uniq ip from output except for duplicated ip
2. how to get the separator ":" from the output
so first field is IP and second field is port
I need your help..!!!
Solved! Go to Solution.
1 REPLY 1
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2008 06:28 PM
03-31-2008 06:28 PM
Solution
>> how to get the separator ":" from the output
| tr ":" " "
>> how to get the uniq ip from output except for duplicated ip
| sort -u -k 1,1
So it could be:
netstat -n | awk '{ print $5}'| grep ":80 " | tr ":" " " | sort -u -k 1,1
| tr ":" " "
>> how to get the uniq ip from output except for duplicated ip
| sort -u -k 1,1
So it could be:
netstat -n | awk '{ print $5}'| grep ":80 " | tr ":" " " | sort -u -k 1,1
Por que hacerlo dificil si es posible hacerlo facil? - Why do it the hard way, when you can do it the easy way?
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
News and Events
Support
© Copyright 2024 Hewlett Packard Enterprise Development LP