So I have a file with contents in the following format,
randomString abc\/def/ghi/mno\/pq/r abc\/def\/ghi/mno\/pq/r
My intention is to replace all occurrences of
\/ between two alpha-numeric strings if the ending word does not have a
/, so ideally, it should be
randomString abc\/def\/ghi\/mno\/pq/r abc\/def\/ghi\/mno\/pq/r
I was able to nearly achieve the result using this
perl -pe 's/(\/\w+)\/(\w+\/|\w+\\)/$1\\\/$2/g' file
which is returning me
randomString abc\/def\/ghi/mno\/pq/r abc\/def\/ghi\/mno\/pq/r
for some reason am not able to figure out why
ghi/mno part of the string is not getting modified.
Am looking for a way to do this in
perl command line.