awk
Hal Moroff
hal at junkyard.UUCP
Tue Apr 9 04:40:32 AEST 1991
I'm trying to use awk to read an ascii file, and translate only
certain fields. I have my own special filter that will be used for the
translation.
I can get awk to read my input file and extract the desired fields.
I can also get it to invoke my filter passing those fields, however I cannot
get the filter return value assigned to a variable in my awk program.
My hands are slightly tied in that I cannot modify the way the
filter works.
An awk code fragment follows:
-------------------------------------------------------------------------------
#
# awk script to filter selected fields
#
#
BEGIN { }
/.*/ {
# the following statement works whether I use 'cat' or my own filter
print ">> " $1 | "cat"
# however I wish to retrieve the string output by my filter into
# a variable for further processing by 'awk'. I've tried:
# print ">> " $1 | "cat" | getline
# and also:
# print ">> " $1 | "cat" | getline str
# and both return the same error:
#awk: syntax error near line 14
#awk: illegal statement near line 14
}
END { }
-------------------------------------------------------------------------------
Sorry if this distribution is too wide/narrow. I've read notes
a long time, and posted rarely.
Reply by email here or to cognex!hal at ai.mit.edu
Thanx.
- hal
More information about the Comp.unix.wizards
mailing list