I have a list of files which I would like to bulk edit using sed.
- Replace the first line of all the files in a directory with output of
header.txt
- Amend the output of
footer.txt
to all the files.
Say I have to replace the current XML header on all the files in a folder as below:
From:
<?xml version="1.0" encoding="utf-8"?>
To:
<?xml version="1.0" encoding="utf-8"?>
<Container xmlns="http://www.arun-test.com/1.0">
<APIHeader version="2.0" exportTime="Sun Oct 11 09:42:25 EST 2020"></APIHeader>
Also I have to add the output of a file footer.txt
content to all the files in a directory.
Please guide me through the correct steps.
-i
without a backup suffix. See for example How can I achieve portability with sed -i (in-place editing)? – steeldriver Oct 14 '20 at 13:57