title: Swapping Two Strings using Sed
body: <p>I have a file in which I am trying to change two strings or trying to swapping with each other.. </p>
  
  <pre><code>cat filename| grep m07
  
  filesystem special="/abc/ca97" raw="/abc/ca97" directory="/mount/m07" 
  filesystem special="/abc/d1107" raw="/abc/d1107" directory="/m07"
  </code></pre>
  
  <p>so I am trying to swap /mount/m07 with /m07 so that required output should be after operation:</p>
  
  <blockquote>
    <p>filesystem special="/abc/ca97" raw="/abc/ca97" directory="/m07"<br>
    filesystem special="/abc/d1107" raw="/abc/d1107"
    directory="/mount/m07"</p>
  </blockquote>
  
  <p>I tried it with using sed..</p>
  
  <pre><code>sed -e 's/"\/mount\/m07/"\m07/g' -e 's/"\/m07/"\/mount/\/m07' file_name
  </code></pre>
  
  <p>and </p>
  
  <pre><code>sed -e 's/"\/m07/"\/mount/\/m07' -e 's/"\/mount\/m07/"\m07/g' file_name
  </code></pre>
  
  <p>But in both the cases its replacing both the strings so either I get /mount/m07 or /m07 in both of the lines...</p>
  
  <p>could you please suggest the path to reach the desired output...</p>