Let's say I have 2 bash commands:
$ A
apple
pear
lemon
A is writing this really fast but waiting 1 minute after "lemon" to terminate successfully.
I want every line being processed as input for B separately and instantly. but I do not want to wait for A to terminate but rather call a new B for every fast appearing line. B would then add something to the output of A let's say:
$ A <for every line appearing> B
1 apple
1 pear
1 banana
How can I do this with bash?
update
here are the original commands:
$sudo alive6 -l eth1 -W 0.2 | sed -e 's/Alive: \(.*\) \[ICMP echo-reply\]/\1%eth0/' -e'/Scanned.*/d' -e'//d'
responds instantly, while
$sudo alive6 -l eth1 -W 0.2 | sed -e 's/Alive: \(.*\) \[ICMP echo-reply\]/\1%eth0/' -e'/Scanned.*/d' -e'//d' | while read l; do echo $l; done
seems to wait for alive6 to finish