I'm trying to execute this command
sed -i -e "s/BASE_64/$BASE_64/" FILE_NAME
where $BASE_64
is a base 64 representation of a file content.
sed
gives me an error since the string is too long.
Argument list too long
How is it possible to avoid this error?
Best Answer
First, save the base64-encoded data in a file called, e.g.,
base64.txt
.For example:
Then:
This uses
ed
to search inFILENAME
for a line containing the stringBASE64
, insert the contents ofbase64.txt
after that line, go back to the first line, then search for the line with stringBASE64
again and delete it. Thew
command ined
saves the modified file.