- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - Linux
- >
- Re: PERL help
Operating System - Linux
1748198
Members
2717
Online
108759
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
тАО12-09-2005 09:16 AM
тАО12-09-2005 09:16 AM
Hi,
Please find below the PERL script:
#!/opt/perl/bin/perl -w
my @wlnparr = `cat wlnp_ip`;
foreach(@wlnparr)
{
my @logarr = `rsh $_ cat /tmp/TC1207*`;
foreach(@logarr)
{
my @tmparr = split(/;/,$_);
print $tmparr[1]."\n";
}
}
The host name of the servers are present in wlnp_ip.
Whenever I execute this script, the server is hung and I get the message
"ioctl TIOCFLUSH: Invalid argument".
Please help.
Thanks,
Anand
Please find below the PERL script:
#!/opt/perl/bin/perl -w
my @wlnparr = `cat wlnp_ip`;
foreach(@wlnparr)
{
my @logarr = `rsh $_ cat /tmp/TC1207*`;
foreach(@logarr)
{
my @tmparr = split(/;/,$_);
print $tmparr[1]."\n";
}
}
The host name of the servers are present in wlnp_ip.
Whenever I execute this script, the server is hung and I get the message
"ioctl TIOCFLUSH: Invalid argument".
Please help.
Thanks,
Anand
Solved! Go to Solution.
- Tags:
- Perl
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-10-2005 05:21 AM
тАО12-10-2005 05:21 AM
Re: PERL help
Does the command "rsh cat /tmp/TC1207*" itself work outside perl? Where is the * resolved? locally or remotely? You may need some quotes.
Do you not need to chomp the newline of the cat data?
Minor comments.... why for a process, activate and image, for something perl can do natively? In you cat, that initial `cat`. Why not something like:
open WLN," @wlnparr=;
Why instantiate the arrays.Of course they may be useful if you have to combine data later on, but in the examlpe you could just process the data as it arrives:
And you coudl re-arrange the loop some and just provide the list as argument:
while (<>) {
chomp;
foreach $line (`rsh $_ ... `) {
foreach $word (split(/;/,$line)) {
print...
}
}
}
and consider using: print (split(/;/,$line))[1] ...
fwiw,
Hein.
Do you not need to chomp the newline of the cat data?
Minor comments.... why for a process, activate and image, for something perl can do natively? In you cat, that initial `cat`. Why not something like:
open WLN,"
Why instantiate the arrays.Of course they may be useful if you have to combine data later on, but in the examlpe you could just process the data as it arrives:
And you coudl re-arrange the loop some and just provide the list as argument:
while (<>) {
chomp;
foreach $line (`rsh $_ ... `) {
foreach $word (split(/;/,$line)) {
print...
}
}
}
and consider using: print (split(/;/,$line))[1] ...
fwiw,
Hein.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО12-10-2005 11:12 PM
тАО12-10-2005 11:12 PM
Solution
1. Chomp
2. use strict
3. more perlish
--8<---
#!/opt/perl/bin/perl
use strict;
use warnings;
@ARGV = ("wlnl_ip");
while (<>) {
chomp (my $ip = $_); # Important! clip the newline
open my $tc, "rsh $host cat /tmp/TC1207* |";
while (<$tc>) {
chomp;
my @tmparr = split m/;/, $_;
print "$tmparr[1]\n";
}
}
-->8---
Enjoy, Have FUN! H.Merijn
2. use strict
3. more perlish
--8<---
#!/opt/perl/bin/perl
use strict;
use warnings;
@ARGV = ("wlnl_ip");
while (<>) {
chomp (my $ip = $_); # Important! clip the newline
open my $tc, "rsh $host cat /tmp/TC1207* |";
while (<$tc>) {
chomp;
my @tmparr = split m/;/, $_;
print "$tmparr[1]\n";
}
}
-->8---
Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
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