Using sed to find an replace, using input files for the pattern and replace

Published: 8/11/2019
Using sed to find an replace, using input files for the pattern and replace
Source: UNIX.STACKEXCHANGE.COM

I'm trying to accomplish the following: File 1 1 2 3a 4a 5 File 2 3b 4b Output 1 2 3b 4b 5 I've been using cat File1 | xargs -i sed -i '/{}/r File2/' output. This gives me: 1 2 3b 4b 3b 4b 5 I think the problem is that sed doesn't search for the pattern using the whole file at once (it replaces by line) and I was wondering how I could fix this.

Read more
Related news
Comment
FACEBOOK