help-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Is system() output guaranteed to appear in order?


From: Ed Morton
Subject: Is system() output guaranteed to appear in order?
Date: Sun, 20 Nov 2022 06:27:13 -0600
User-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.5.0

I thought I remembered running an awk command like (simplified example of course):

   seq 5 | awk '/3/{system("echo foo")} 1'

and seeing output like:

   $ seq 5 | awk '/3/{system("echo foo")} 1'
   1
   2
   3
   4
   5
   foo

instead of:

   $ seq 5 | awk '/3/{system("echo foo")} 1'
   1
   2
   foo
   3
   4
   5

but right now I can't reproduce that and I'm wondering if maybe I'm misremembering or just haven't hit on the right scenario. Is the output of a call to `system()` guaranteed to always appear inline among the awk output at the location where it was called or does it depend on the command you're calling or some environment settings or something? If the latter, what would be an example of that?

    Ed.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]