a.out be the program which produces lots of messages to stdout, e.g.:
$ ./a.out A: abc B: xyz A: aaa A: bbb B: zzz C: fff ...
What I need is to distinct the output into separate files, one should contain lines with
A: prefix, second with
B: and so all, leaving the lines which does not match any pattern to stdout.
Of course one can redirect the whole output of
a.out, and then
greping it. But if output file will use much disk space, there may be not enough space for
It would be nice to have some
partial-redirect command which can be used in that case like that:
./a.out | partial-redirect ^A: a.txt | partial-redirect ^B: b.txt | partial-redirect ^C: c.txt > rest.txt
Is such command exist and common, or you should implement something yourself to solve this task?