Article View: comp.unix
Article #411Re: AWK and the system() command
From: The Moderator
Date: Thu, 18 Jun 1987 13:20
Date: Thu, 18 Jun 1987 13:20
39 lines
1405 bytes
1405 bytes
[Here are two responses on the AWK question. -mod]
--------
From: domo@sphinx.co.uk
"There is no problem that cannot be solved by adding one level of
indirection." Somebody like Dijkstra said something like that.
-- Anyway --
What you can do is have awk generate a shell script containing the cat
commands:
awk ' S1 == "The proper line" {print "cat file1"}' | sh
Have fun.
Dominic Dunlop Sphinx Ltd. (domo@sphinx.co.uk)
-----
From: Brian Katzung <katzung@laidbak.UUCP>
Organization: Lachman Associates, Inc, Chicago
awk '
{
if ($1 == "#include")
system("cat " $2)
else
print
}'
I don't have a SVR3 system handy just now, but I believe you will
find that this awk program copies its input to its output, replacing
lines of the form
#include some_file
with the contents of some_file.
-- Brian Katzung ihnp4!laidbak!katzung
Technical Details
Message-ID:
<885@mcdchg.UUCP>Path:
arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!husc6!sri-unix!sri-spam!mordor!lll-tis!ptsfa!ihnp4!upba!mcdchg!usenetShow Full Headers
Complete Article Headers
Relay-Version: version B 2.10 5/3/83; site utzoo.UUCP Path: arc1-ca.pugleaf.net!utzoo!mnetor!seismo!ut-sally!husc6!sri-unix!sri-spam!mordor!lll-tis!ptsfa!ihnp4!upba!mcdchg!usenet From: usenet@mcdchg.UUCP (The Moderator) Newsgroups: comp.unix Subject: Re: AWK and the system() command Message-ID: <885@mcdchg.UUCP> Date: Thu, 18-Jun-87 09:20:47 EDT Article-I.D.: mcdchg.885 Posted: Thu Jun 18 09:20:47 1987 Date-Received: Mon, 22-Jun-87 03:44:45 EDT Sender: usenet@mcdchg.UUCP Lines: 39 Approved: usenet@mcdchg.UUCP