I have two text files. Using sed or grep, how can i find matching string and then replace the string from text2.txt?
It should search anything under name=" ". If found, replace it what is under path=" ". output.txt has desired output data.
test1.txt
domain merge_requests
abc frameworks merge_requests
dvc frame-test merge_requests
test2.txt
<project path="test/domain" name="device/common" />
<project path="test1/frameworks " name="test/frameworks" />
<name="test/frame-test" project path="test3/frame-test" />
output.txt
test/domain merge_requests
test1/frameworks merge_requests
test/frame-test merge_requests
sed
orgrep
? What's the point of theabc
anddvc
, they seem to be gone from the output (but I can't tell why). Also, is the final line oftest2.txt
correct? – ilkkachu Sep 20 '16 at 22:05