- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- easy way to convert this into one single line file
Operating System - HP-UX
1753797
Members
7338
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-20-2011 08:22 AM
тАО01-20-2011 08:22 AM
Hi
I have the cisco switch config file in this format. Basically it is a zone name with the zone member alias and WWN
============================
zone name NOCVMHOST19_HBA1_CX4_486_SPA_P4 vsan 10
fcalias name NOCVMHOST19_HBA1 vsan 10
pwwn 10:00:00:00:c9:74:16:11
fcalias name CX4_486_SPA_P4 vsan 10
pwwn 50:06:01:64:44:60:2d:da
zone name NOCVMHOST19_HBA1_CX4_486_SPB_P4 vsan 10
fcalias name NOCVMHOST19_HBA1 vsan 10
pwwn 10:00:00:00:c9:74:16:11
fcalias name CX4_486_SPB_P4 vsan 10
pwwn 50:06:01:6c:44:60:2d:da
============================
I wish to convert it into the following format so that I can easily import into excel file. Basically each line is consist of the zone name, first zone member alias, wwn and second zone member alias wwn. Can this be done via normal shell script?
NOCVMHOST19_HBA1_CX4_486_SPA_P4 NOCVMHOST19_HBA1 10:00:00:00:c9:74:16:11 CX4_486_SPA_P4 50:06:01:64:44:60:2d:da
NOCVMHOST19_HBA1_CX4_486_SPB_P4 NOCVMHOST19_HBA1 10:00:00:00:c9:74:16:11 CX4_486_SPB_P4 50:06:01:6c:44:60:2d:da
I have the cisco switch config file in this format. Basically it is a zone name with the zone member alias and WWN
============================
zone name NOCVMHOST19_HBA1_CX4_486_SPA_P4 vsan 10
fcalias name NOCVMHOST19_HBA1 vsan 10
pwwn 10:00:00:00:c9:74:16:11
fcalias name CX4_486_SPA_P4 vsan 10
pwwn 50:06:01:64:44:60:2d:da
zone name NOCVMHOST19_HBA1_CX4_486_SPB_P4 vsan 10
fcalias name NOCVMHOST19_HBA1 vsan 10
pwwn 10:00:00:00:c9:74:16:11
fcalias name CX4_486_SPB_P4 vsan 10
pwwn 50:06:01:6c:44:60:2d:da
============================
I wish to convert it into the following format so that I can easily import into excel file. Basically each line is consist of the zone name, first zone member alias, wwn and second zone member alias wwn. Can this be done via normal shell script?
NOCVMHOST19_HBA1_CX4_486_SPA_P4 NOCVMHOST19_HBA1 10:00:00:00:c9:74:16:11 CX4_486_SPA_P4 50:06:01:64:44:60:2d:da
NOCVMHOST19_HBA1_CX4_486_SPB_P4 NOCVMHOST19_HBA1 10:00:00:00:c9:74:16:11 CX4_486_SPB_P4 50:06:01:6c:44:60:2d:da
abc
Solved! Go to Solution.
- Tags:
- Perl
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-20-2011 09:14 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-20-2011 11:14 AM
тАО01-20-2011 11:14 AM
Re: easy way to convert this into one single line file
Hi:
You could do:
# cat ./refomat
#!/usr/bin/perl
use strict;
use warnings;
local $/ = "";
my ( $zone, $alias_1, $wwn_1, $alias_2, $wwn_2 );
while (<>) {
if ( m{^zone} ) {
( $zone, $alias_1, $wwn_1 ) =
m{zone name (\S+).+fcalias name (\S+).+pwwn (\S+)}s;
}
elsif ( m{^fcalias} ) {
( $alias_2, $wwn_2 ) =
m{fcalias name (\S+).+pwwn (\S+)}s;
print "$zone $alias_1 $wwn_1 $alias_2 $wwn_2\n";
}
}
1;
...run as:
# ./reformat configfile
Regards!
...JRF...
You could do:
# cat ./refomat
#!/usr/bin/perl
use strict;
use warnings;
local $/ = "";
my ( $zone, $alias_1, $wwn_1, $alias_2, $wwn_2 );
while (<>) {
if ( m{^zone} ) {
( $zone, $alias_1, $wwn_1 ) =
m{zone name (\S+).+fcalias name (\S+).+pwwn (\S+)}s;
}
elsif ( m{^fcalias} ) {
( $alias_2, $wwn_2 ) =
m{fcalias name (\S+).+pwwn (\S+)}s;
print "$zone $alias_1 $wwn_1 $alias_2 $wwn_2\n";
}
}
1;
...run as:
# ./reformat configfile
Regards!
...JRF...
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