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