Skip to content

Instantly share code, notes, and snippets.

@arc279
Created June 16, 2017 08:11
Show Gist options
  • Save arc279/dcc62ee7a877975f493abae4082b2c64 to your computer and use it in GitHub Desktop.
Save arc279/dcc62ee7a877975f493abae4082b2c64 to your computer and use it in GitHub Desktop.
stdinをteeで分割した後の処理の出力を統合する
#!/bin/bash
rm -f fifo
mkfifo fifo
cat fifo | sort > out &
cat <<EOD | tee >(cut -f1 >fifo) >(cut -f2 >fifo) >(cut -f3 >fifo) >(cut -f4 >fifo) >/dev/null
aaa 111 444 777
bbb 222 555 888
ccc 333 666 999
EOD
wait
rm fifo
111
222
333
444
555
666
777
888
999
aaa
bbb
ccc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment