I'm trying to execute this commandsed -i -e s/BASE_64/$BASE_64/ FILE_NAMEwhere $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 longHow is it possible to avoid this error?
Replace a long string with the sed command: Argument list too long error
bash;shell script;sed
First, save the base64-encoded data in a file called, e.g., base64.txt.For example:base64 < originalfile > base64.txtThen:printf '%s\n' '/BASE64/r base64.txt' 1 '/BASE64/d' w | ed FILENAMEThis uses ed to search in FILENAME for a line containing the string BASE64, insert the contents of base64.txt after that line, go back to the first line, then search for the line with string BASE64 again and delete it.  The w command in ed saves the modified file.