- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Merge 2 scripts to one output
Operating System - Linux
1753821
Members
8913
Online
108805
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
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
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
тАО01-17-2006 07:55 PM
тАО01-17-2006 07:55 PM
Hi,
I found 2 scripts (laninfo & lanspeeed).
I want to merge this 2 scripts to one and one output but I dont now how. This scripts have to run on hpux 10.20 & 11.11.
laninfo:
Device IP MAC Hostname in /etc/hosts
-------------------------------------------------------------------------------
lan0 NONE 08:05:09:A3:38:96 NONE
lan1 30.230.14.3 01:33:6E:27:89:95 hp00003
lanspeed:
Card at PPA 0 - IP Address: Not assigned -
Card at PPA 1 - IP Address: 30.230.14.3 - Config = 100 Full-Duplex MANUAL
Wanted output:
Device IP MAC Hostname speed auto/manual
-------------------------------------------------------------------------------
lan0 NONE 08:05:09:A3:38:96 NONE
lan1 30.230.14.3 01:33:6E:27:89:95 hp00003 100 manual
Hope you can help.
I found 2 scripts (laninfo & lanspeeed).
I want to merge this 2 scripts to one and one output but I dont now how. This scripts have to run on hpux 10.20 & 11.11.
laninfo:
Device IP MAC Hostname in /etc/hosts
-------------------------------------------------------------------------------
lan0 NONE 08:05:09:A3:38:96 NONE
lan1 30.230.14.3 01:33:6E:27:89:95 hp00003
lanspeed:
Card at PPA 0 - IP Address: Not assigned -
Card at PPA 1 - IP Address: 30.230.14.3 - Config = 100 Full-Duplex MANUAL
Wanted output:
Device IP MAC Hostname speed auto/manual
-------------------------------------------------------------------------------
lan0 NONE 08:05:09:A3:38:96 NONE
lan1 30.230.14.3 01:33:6E:27:89:95 hp00003 100 manual
Hope you can help.
Peter Lachnitt
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-17-2006 10:04 PM
тАО01-17-2006 10:04 PM
Re: Merge 2 scripts to one output
hello,
merge.awk is
/Card/ { info[$8] = substr($0,index($0,"=")) ; next ;}
{ printf "%s %s \n",$0,info[$2] ; }
you launch with
( ./lanspeed.sh ; ./laninfo.sh ) | awk -f merge.awk
Device IP MAC Hostname in /etc/hosts
-------------------------------------------------------------------------------
lan0 NONE 08:05:09:A3:38:96 NONE
lan1 30.230.14.3 01:33:6E:27:89:95 hp00003 = 100 Full-Duplex MANUAL
you can adjust what is printed in substr($0,index($0,"="))
Jean-Yves
merge.awk is
/Card/ { info[$8] = substr($0,index($0,"=")) ; next ;}
{ printf "%s %s \n",$0,info[$2] ; }
you launch with
( ./lanspeed.sh ; ./laninfo.sh ) | awk -f merge.awk
Device IP MAC Hostname in /etc/hosts
-------------------------------------------------------------------------------
lan0 NONE 08:05:09:A3:38:96 NONE
lan1 30.230.14.3 01:33:6E:27:89:95 hp00003 = 100 Full-Duplex MANUAL
you can adjust what is printed in substr($0,index($0,"="))
Jean-Yves
- Tags:
- awk
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-17-2006 10:59 PM
тАО01-17-2006 10:59 PM
Solution
Here's my version.
The requirement to run it on 10.20 made it a bit tricky: on 10.20 lanadmin requires NMID, on 11.00 and above it uses PPA numbers.
Besides, on 10.20 it seems the duplex and autonegotiate values can't always be detected. This will print out question marks to the appropriate columns in that case.
I know you did not ask the full/half duplex info, but I threw it in anyway... :-)
The speed value has 5 spaces, so it should handle 10gig NICs if they can be queried the same way.
On 11.00 and 11.11 there may be variations in the format of "lanadmin -x" output, but it should be easy to modify the script to cope with them.
Duplex is two letters, either HD or FD.
Auto/manual is just one letter, so it is A/M. I wanted to keep the line length in 80 characters, so it won't look ugly on a standard console terminal.
The requirement to run it on 10.20 made it a bit tricky: on 10.20 lanadmin requires NMID, on 11.00 and above it uses PPA numbers.
Besides, on 10.20 it seems the duplex and autonegotiate values can't always be detected. This will print out question marks to the appropriate columns in that case.
I know you did not ask the full/half duplex info, but I threw it in anyway... :-)
The speed value has 5 spaces, so it should handle 10gig NICs if they can be queried the same way.
On 11.00 and 11.11 there may be variations in the format of "lanadmin -x
Duplex is two letters, either HD or FD.
Auto/manual is just one letter, so it is A/M. I wanted to keep the line length in 80 characters, so it won't look ugly on a standard console terminal.
MK
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-18-2006 02:11 AM
тАО01-18-2006 02:11 AM
Re: Merge 2 scripts to one output
Thanks Jean-Yves & Matti
Matti you are the best. Your version is working and gives my the output that I wanted.
Peter
Matti you are the best. Your version is working and gives my the output that I wanted.
Peter
Peter Lachnitt
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