How can I manipulate text in bash? : <p>How can I manipulate text in bash using either awk, grep, perl or sed? </p>

<p>Input:</p>

<pre><code>ted foo,bar,zoo
john ket,ben
</code></pre>

<p>Expected Output:</p>

<pre><code>foo,ted
bar,ted
zoo,ted
ket,john
ben,john
</code></pre>
