I have this file.txt
:
a b c
a f g
e h j
I wrote an awk script that does
BEGIN {...}
{...}
END {
a = "a"
b = "b"
system("grep " a " file.txt | grep " b " > t")
}
I expect it to print a b c
in file t
. Running the same script from ConEmu
on Windows 7 will produce an empty t
file. On the other hand, executing grep a file.txt | grep b > t
will produce the expected result.
why am I doing so: I'm parsing obscure data from a complicated file with multiple field separators (or nested fields, if you prefer). After having the structure of the input file (which is not file.txt
), since each line is a command that will be executed and their order is important to me, I would like to know if something is set to something else and if that is a condition for a new command to be introduced in the input file using awk. The condition file database is file.txt
.
Why is that? Am I doing something wrong? Am I blind somehow? On Windows 7, gawk 4.2.0, (GNU) grep 2.4.2
I'm also unable to locate similar questions that might help: if you know any, do flag this as duplicate.