Specific question
-----------------

What is a shell command to turn strings like this

```
class A(B, C):

```

into sets of strings like this

```
B -> A; 
C -> A;

```

Where A, B, and C are all of the form \w+ and, where I've written "B, C" I really mean any number of terms separated by commas and whitespace. I.e. "B, C" could equally be "B" or "B, C, D, E".

Big picture
-----------

I'm visualizing the class hierarchy of a Python project. I'm looking into a directory for all .py files, grepping for class declarations and then converting them to [DOT format](http://en.wikipedia.org/wiki/Dot_language). So far I've used find and grep to get a list of lines. I've done what is above in [a small python script](https://gist.github.com/3332164). If possible I'd like to use just the standard unix toolchain instead. Ideally I'd like to find another composable tool to pipe into and out of and complete the chain.