I was reading this and was going to mention that that operation is easy with imagemagick, which can read raw files directly. The tag solution is much quicker though. dcraw can also save the color planes separately as greyscale images, and could probably convert with a swapped interpretation as well.
Update
The -d option of dcraw can export the pixels as-is, it will appear as greyscale with no debayering. It would need further processing.
Separating color channels with imagemagick is described here
http://www.imagemagick.org/Usage/color_basics/#separateIt's possible to swap channels with "piplining" and not use temporary files.