title: How can I swap two columns using sed?
body: <p>I'm trying to change the text in a file from this:</p>
  
  <pre><code>file.txt,c:\path\to\file
  file.txt,c:\path with spaces\to\file
  file.txt,c:\path\to\file with spaces
  file.txt,c:\path\to\file with spaces
  file.txt,c:\path\to\file with spaces
  </code></pre>
  
  <p>To this kind of output (one path to the file):</p>
  
  <pre><code>c:\path\to\file\file.txt
  c:\path with spaces\to\file\file.txt
  c:\path\to\file with spaces\file.txt
  c:\path\to\file with spaces\file.txt
  c:\path\to\file with spaces\file.txt
  </code></pre>
  
  <p>This ALMOST works but requires a ',' on the end of the line :</p>
  
  <pre><code>sed 's@\(.*\),\(.*\),\(.*\)@\2,\1,\3@g' file
  </code></pre>
  
  <p>Any help would be appreciated, I don't know sed all that well...</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>This worked for me but I would still like to add a "\" in there:</p>
  
  <pre><code>sed 's@\(.*\),\(.*\)@\2,\1,\3@g' file
  </code></pre>