I’m in the process of moving from my gogs instance on git.icod.de to my gitea instance on code.icod.de
In this process I’m migrating countless packages manually. It’s quite a lot of work.
Often I need to replace “git.icod.de’ with ‘code.icod.de’
To do this on a Linux machine I use the following 1-liner:
1 |
grep 'git\.icod\.de/dalu/blogs' * -rl | xargs sed -i 's/git\.icod\.de\/dalu\/blogs/code.icod.de\/dalu\/blogs/g' |
In this example I’m replacing git.icod.de/dalu/blogs with code.icod.de/dalu/blogs. Since sed uses regexp search I have to escape the .
and /
. I could’ve used ~ as delimiters. If I had the 1-liner would look like this:
1 |
grep 'git\.icod\.de/dalu/blogs' * -rl | xargs sed -i 's~git\.icod\.de/dalu/blogs~code.icod.de/dalu/blogs~g' |