Ich habe drei Dateien
~/naive-file.txt
~/old-text.txt
~/new-text.txt
Ich möchte jeden Fall finden, in dem der Inhalt von ~/old-text.txtvorkommt, ~/naive-file.txtund diese Vorkommen durch den Inhalt von ersetzen ~/new-text.txt. Ich bin mir sicher, dass dies mit sedoder machbar ist, awkaber ich kann anscheinend nicht den richtigen Befehl finden. Ist das möglich?
Angenommen, der Inhalt von ~/naive-file.txtist
$ cat ~/naive-file.txt
Sed id ligula quis est convallis tempor.
This is the old text.
It might have multiple lines and some special characters like these \ { & % #)!
etc...
Nunc aliquet, augue nec adipiscing interdum, lacus tellus malesuada massa, quis
varius mi purus non odio.
Angenommen, der Inhalt von ~/old-text.txtist
$ cat ~/old-text.txt
This is the old text.
It might have multiple lines and some special characters like these \ { & % #)!
etc...
Angenommen, der Inhalt von ~/new-text.txtist
$ cat ~/new-text.txt
This is the new text.
It could also have multiple lines and special characters like these \ { & %
etc...
Das Ausführen meines gewünschten Befehls würde dann erzeugen
Sed id ligula quis est convallis tempor.
This is the new text.
It could also have multiple lines and special characters like these \ { & %
etc...
Nunc aliquet, augue nec adipiscing interdum, lacus tellus malesuada massa, quis
varius mi purus non odio.
old-text.txtdurch erste Zeichenfolge von ersetzt werdennew-text.txtund so weiter?