I am trying to use sed in a bash file to add the following after it finds AddDefaultCharset UTF-8
<IfModule mime_magic_module>
MIMEMagicFile conf/magic
</IfModule>
To simplify things I am focusing just on adding the first line until I get it right, I have this so far.....
sed '/AddDefaultCharset UTF-8/a <IfModule mime_magic_module>' /home/testfile.ini
But when I try running this it just echos out the entire file, where am I going wrong?
augtoolfor editing config files. – ctrl-alt-delor Jan 03 '21 at 21:45AddDefaultCharset UTF-8doesn't exist in your file. Maybe the space is a tab instead of a blank, idk. Try justsed -n '/AddDefaultCharset UTF-8/p'and/or searching for smaller substrings of that (e.g.AddDefault, etc.) instead til you figure out where you're going wrong with your search regexp. – Ed Morton Jan 03 '21 at 22:06