Description of problem: The info page for sed says that the q command immediately quits. However, it doesn't. Version-Release number of selected component (if applicable): sed-4.2.2-11.fc23.x86_64 How reproducible: Always Steps to Reproduce: (echo 'PostgreSQL init process complete; ready for start up.'; sleep 3; echo foo)|sed -n -e '/PostgreSQL init process complete/q' Actual results: Output is correct (no output) but it takes 3 seconds Expected results: Should return instantly Additional info: Same bug happens with Q, or Q 1
sed does quit immediately, but the shell doesn't exit until the whole pipeline is done. Try this: $ (echo 'PostgreSQL init process complete; ready for start up.'; sleep 3; echo foo)|(sed -n -e '/PostgreSQL init process complete/q'; echo bar) And you'll see that "bar" is printed immediately.