Categories
Linux Mastering Development

How to replace multiple file lines with an edited grep output?

I grep recursively in a directory, now I got an output.
Look through the lines, I change lines what I need to change, and remove lines what I don’t need to change.

like

grep.txt

./path/a.c:12345:         AAAAAA:AA
./path/b.c:123:             BBBBB:BBB
./path/b.c:1238:           CCCCCC:CC

edited grep.txt

./path/a.c:12345:         cccc:ccc
./path/b.c:1238:            bbb:bbbbbbb

it meant’s I want to change the files with my edited grep.txt, I need 12345 line in ./path/a.c is

     cccc:ccc

1238 line in ./path/b.c is

        bbb:bbbbbbb

Is there any solution use awk, sed or any other tools?

Leave a Reply

Your email address will not be published. Required fields are marked *