- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- awk's support of two-way communication with anothe...
Categories
Company
Local Language
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
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
Community
Resources
Forums
Blogs
- 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
08-01-2002 01:16 AM
08-01-2002 01:16 AM
awk's support of two-way communication with another process
Here is HP-UX B.11.00 computer with awk in /usr/bin/awk. Upon I tried to perform connection to other process by |&, got a message: "|& - cannot be correctly parsed". Does the gawk only can parse the operation? Or what can I do for this communication implementation?
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2002 02:02 AM
08-01-2002 02:02 AM
Re: awk's support of two-way communication with another process
I'm not a strong supporter of awk, and thus only use it when one cannot expect Perl to be installed on a box.
So I don't know how awk can handle bidirectional communication.
But I do know that Perl can do this through pipe(), fork(), and exec().
Despite you should be carefull because bidirectional communication always has a latent peril of a deadlock situation, where either both sides are talking or listening simultaniously.
So you would have to make sure that only one side is either talking or listening.
If you want to do it in Perl have a look at the perlipc POD (i.e. at the shell type "perldoc perlipc"), which has many sample code fragments, and also addresses how to do bidirectional communication (so I think).
If you are interested, I could also send you chapter 16 of the "Perl Cookbook" (a must-have for any Perl hacker), which I have on CDROM, and is all about IPC and Perl.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2002 02:49 AM
08-01-2002 02:49 AM
Re: awk's support of two-way communication with another process
Thank you very much, but Perl is my next target and now I have to do what I can. Anyway, your suggestions are welcome.
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2002 03:44 AM
08-01-2002 03:44 AM
Re: awk's support of two-way communication with another process
Cheers!
James
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2002 03:55 AM
08-01-2002 03:55 AM
Re: awk's support of two-way communication with another process
#
# test coprocessing
#
BEGIN {
command = "LC_ALL=C sort"
n = split("abcdefghijklmnopqrstuvwxyz", a, "")
for (i = n; i > 0; i--)
print a[i] |& command
close(command, "to")
while ((command |& getline line) > 0)
print "got", line
close(command)
}
#####eof
/usr/bin/awk -f copr.awk
syntax error The source line is 12.
The error context is
print a[i] >>> |& <<< command
awk: The statement cannot be correctly parsed.
The source line is 12.
syntax error The source line is 14.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2002 06:15 AM
08-01-2002 06:15 AM
Re: awk's support of two-way communication with another process
Are you sure that awk supports "|&"?
-- Rod Hills
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2002 06:42 AM
08-01-2002 06:42 AM
Re: awk's support of two-way communication with another process
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-01-2002 06:52 AM
08-01-2002 06:52 AM
Re: awk's support of two-way communication with another process
If you really want to make this work with awk, then you can get gawk from a CPAN site like http://hpux.cs.utah.edu/.
Good Luck
-- Rod Hills