I have a named fifo and I am writing random number to this fifo.
When I write to fifo I want to find written text in numbers.txt
file and write the result row to stdout.
Content of numbers.txt
file is:
1 one
2 two
3 three
... and so on
I want to search text which piped to grep
in this file.
For example If I write 1
to named pipe, grep should print 1 one
to stdout.
I am running command shown as below in first terminal:
cat <> myfifo | grep -f - numbers.txt
And I am writing to fifo in another terminal show as below:
echo 1 > myfifo
But I can't see any output in stdout in first terminal window.
I want to see 2 two
in first terminal output when I execute echo 2 > myfifo
in second terminal window. How to achive this?
grep -f myfifo numbers.txt
, as in my answer.grep -f myfifo numbers.txt
command not printing any output to stdout.