Skip to main content
2 of 4
deleted 76 characters in body
Mesut Tasci
  • 825
  • 3
  • 13
  • 17

Piping continious stream to grep as search term for search in a file

I have a named fifo and I am writing random number to this fifo.

When I write to fifo I want to grep writed text in numbers.txt and write found row to stdout.

Content of numbers.txt file:

1 one
2 two
3 three
...

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 try below but this does not write anything to stdout:

cat <> myfifo | grep -f - numbers.txt

How to achive this?

Mesut Tasci
  • 825
  • 3
  • 13
  • 17