Do someone know how to run a command for every line emitted in a unix pipe? I tried the oneliner in the linked story using Mac OS X’s `say`, but it doesn’t work with pipes.
ping 127.0.0.1 | sed -e 's/.*/ping/' | xargs -d'\n' -n1 sayAnd `sed -e <command>` is redundant, `-e` is used to specify multiple commands.
You'll also need sed -l to limit buffering.
ping <host> | sed -l 's/.*/ping/' | xargs -n1 say cat input |while read a; do do_something_with $a; doneThe only options in POSIX sed are -e, -f and -n (and -e is usually cargo-culted by people who want -E. -E being a BSD extension enabling extended regular expressions — -r in GNU sed)