Using sed To Find and Replace
Sam Clark

Sam Clark @samrocksc

About: I'm not good at programming :(

Location:
Berlin, Germany
Joined:
Sep 9, 2018

Using sed To Find and Replace

Publish Date: May 23 '19
9 1

Using sed to find and replace

When you need to find and replace a massive amount of modules(think of having to refactor a require to a privately scoped package at your company).

Luckily we're using a nix based system(unless it's windows...then whatever, enjoy windows). We can use sed which is basically going to run commands against a stream. find is basically going to pipe a stream directly into sed, and sed is going to run a simple find/replace scheme(just like we would if we were using vim).

fix foo and move it to point to a private repo:

find ./ -type f -exec sed -i "s/'foo/'@my-org\/foo/g" {} \;

Comments 1 total

Add comment