I am looking for a generic command line solution that would allow me to add or modify a configuration option inside a config file (ini like format).
Most linux configur
Try crudini. BTW I think this file is a shell file rather than an ini file, but crudini can still work in this case:
crudini --set /etc/default/nginx '' ULIMIT '"-n 4096"'