Using bash i'm trying to grep a string coming from /dev/urandom something like this:
tr -cd '[:lower:]' < /dev/urandom | grep -o 'test'
tr -cd '[:lower:]' < /dev/urandom | grep -o 'test' | head -1
grep keeps waiting for
tr to finish, because even redirecting the output to a file like
> /tmp/testfile nothing is written to the file.
However if parsed to
grep, it works
tr -cd '[:lower:]' < /dev/urandom | head -c 10000 | grep -o 'test'
Is there a way to make it work while stdin is still running?, and if not, why is this behavior from
grep, not to give an output if input hasn't finished?