I have an application which will produce a large amount of data which I do not wish to store onto the disk. The application mostly outputs data which I do not wish to use, but a set of useful information that must be split into separate files. For example, given the following output:
JUNK
JUNK
JUNK
JUNK
A 1
JUNK
B 5
C 1
JUNK
I could run the application three times like so:
./app | grep A > A.out
./app | grep B > B.out
./app | grep C > C.out
This would get me what I want, but it would take too long. I also don't want to dump all the outputs to a single file and parse through that.
Is there any way to combine the three operations shown above in such a way that I only need to run the application once and still get three separate output files?
./app | tee >(grep A > A.out) >(grep B > B.out) | grep C > C.out
– evilsoup Oct 26 '13 at 18:13grep
. – ruakh Oct 26 '13 at 19:43