How to Replace a Path Name String Containing a . (dot) & / (slash) with a / Inside Text-file?

If you have ever come across a text file that has some unnecessary characters added before file/directory paths & you need to get rid of that, how would you do it? E.g.




Easy way, just edit the file and that’s it 😀

Good one 🙂 But what if the file has hundreds of lines? 😉

So, below is how to do it inside Vi editor 🙂 Open the file & issue this –


Mission accomplished 😀

Since there was ./ in path, we escaped that using \ Then there were two // so we escaped them using \/\/ And since we had to replace it with a /, we added another /\/

Syntax of replacing text in Vi is –


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s