- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- can PERL handle multiple pipes on 1 line?
Operating System - HP-UX
1753505
Members
4760
Online
108794
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
тАО06-28-2005 05:13 AM
тАО06-28-2005 05:13 AM
Hi all:
Using perl 5.8.3 on a HPUX 11.00.
I have a perl script for helpdesk to assista in management of printers.
A new option, search all printers for a pattern
Easy enough, use grep.
elsif ($choice eq '8') {
print "Search a specific print queue - what is partial printer name? ";
$prt =;
system "/usr/bin/lpstat -t \| grep -i $prt";
&TheMenu;
}
But if I want to add another pipe to 'more', it gives me a syntax error.
system "/usr/bin/lpstat -t \| grep -i $prt | more";
There could be hundreds of printers matching the pattern so I need to page the output. But how do I pipe to more with the above command?
Using perl 5.8.3 on a HPUX 11.00.
I have a perl script for helpdesk to assista in management of printers.
A new option, search all printers for a pattern
Easy enough, use grep.
elsif ($choice eq '8') {
print "Search a specific print queue - what is partial printer name? ";
$prt =
system "/usr/bin/lpstat -t \| grep -i $prt";
&TheMenu;
}
But if I want to add another pipe to 'more', it gives me a syntax error.
system "/usr/bin/lpstat -t \| grep -i $prt | more";
There could be hundreds of printers matching the pattern so I need to page the output. But how do I pipe to more with the above command?
Solved! Go to Solution.
2 REPLIES 2
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2005 05:36 AM
тАО06-28-2005 05:36 AM
Solution
Yes, in this case the system call is simply passed to the shell. The confusion is caused by a LF in stdin.
I'll bet this works:
$prt = "xxx";
system("lpstat -t | grep -i $prt | more")
however your example fails.
after your:
$prt =;
add this line:
chomp($prt);
I think that will fix you.
I also notice that you escaped one of your pipe symbols but not the other; you shouldn't need an escape.
I'll bet this works:
$prt = "xxx";
system("lpstat -t | grep -i $prt | more")
however your example fails.
after your:
$prt =
add this line:
chomp($prt);
I think that will fix you.
I also notice that you escaped one of your pipe symbols but not the other; you shouldn't need an escape.
If it ain't broke, I can fix that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО06-28-2005 05:40 AM
тАО06-28-2005 05:40 AM
Re: can PERL handle multiple pipes on 1 line?
Hi Clay:
Both ways work. Many thanks.
Both ways work. Many thanks.
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