I have a script that reads a file that contains urls and then prints out the ip addresses. However, I am unable to find resources as to why the pipe blocks when I add the command
cut -d" " -f4
at the end of the pipe. Here is the full command.
for url in $(cat urls); do host $url; done | grep "has address" | cut -d" " -f4
The output is printed asynchronously till the grep command. Any command that comes after the grep has its output blocked till all the urls have been processed by the host command. Can anyone give me insight as to why this happens?