home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!ukma!darwin.sura.net!dtix!mimsy!afterlife!adm!news
- From: partl@hp01.boku.ac.at (Hubert Partl)
- Newsgroups: comp.unix.questions
- Subject: Re: problems with awk: output redirection and getline in a pipe
- Message-ID: <34103@adm.brl.mil>
- Date: 16 Nov 92 09:28:57 GMT
- Sender: news@adm.brl.mil
- Lines: 18
-
- > awk 'BEGIN {print "...something"}
- > {print " ...anything for every line"}
- > END {printf("%2d\n", NR) >"awk.tmp" }' |
- > sort |
- > awk 'BEGIN {getline < "awk.tmp";
- > numberoflines = $1}
- > {print "---anything for every line"}
- > END {printf("%2d\n", numberoflines)} '
-
- All three processes of the pipe "awk | sort | awk" are running in
- parallel, the last awk starts BEFORE the first awk has ended and
- therefore reads an old awk.tmp, not the new one.
-
- --
- Dr. Hubert Partl Mail: partl@mail.boku.ac.at
- EDV-Zentrum, Universitaet fuer Bodenkultur Phone: (+43 1) 36 92 924 - 233
- Nussdorfer Laende 11 Fax: (+43 1) 36 92 924 - 200
- A-1190 Wien, Austria (-: Make laugh, not war! :-)
-