HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: shell script awk help
Operating System - HP-UX
1832925
Members
2822
Online
110048
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
Forums
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
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
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
05-08-2002 08:18 PM
05-08-2002 08:18 PM
shell script awk help
abc
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2002 09:05 PM
05-08-2002 09:05 PM
Re: shell script awk help
Hi,
Off my head, a simple perl script can go something like this:
=======================================
#!/usr/bin/perl
open (FILE, "nnm.txt");
while ()
{
if (/HOSTNAME: (.*)/)
{
host=$1;
}
elsif (/NUMBER OF INTERFACES:(\d+)/)
{
int=$1;
}
elsif (/IP ADDR: (.*)/)
{
ipaddr=$1;
# even if there are multiple IP addresses, the $host, $int will still be correct.
print STDOUT "$host,$int,$ipaddr\n";
}
}
close (FILE);
=======================================
Hope this helps. Regards.
Steven Sim Kok Leong
Off my head, a simple perl script can go something like this:
=======================================
#!/usr/bin/perl
open (FILE, "nnm.txt");
while (
{
if (/HOSTNAME: (.*)/)
{
host=$1;
}
elsif (/NUMBER OF INTERFACES:(\d+)/)
{
int=$1;
}
elsif (/IP ADDR: (.*)/)
{
ipaddr=$1;
# even if there are multiple IP addresses, the $host, $int will still be correct.
print STDOUT "$host,$int,$ipaddr\n";
}
}
close (FILE);
=======================================
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-08-2002 09:14 PM
05-08-2002 09:14 PM
Re: shell script awk help
Hi,
I just noticed that I have missed out the $ sign for the variable. It should thus be:
$host="$1";
$int="$1";
$ipaddr="$1";
instead of:
host=$1;
int=$1;
ipaddr=$1;
Hope this helps. Regards.
Steven Sim Kok Leong
I just noticed that I have missed out the $ sign for the variable. It should thus be:
$host="$1";
$int="$1";
$ipaddr="$1";
instead of:
host=$1;
int=$1;
ipaddr=$1;
Hope this helps. Regards.
Steven Sim Kok Leong
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.
Company
Events and news
Customer resources
© Copyright 2025 Hewlett Packard Enterprise Development LP