I've noticed that some Linux configuration files (e.g. /etc/samba/smb.conf) expect you to enter the actual settings (key value pairs) in a particular section of the file such as [global].I'm looking for a terminal tool/command which allows you to append lines to a specific section of a specific configuration file. Example:configadd FILE SECTION LINEconfigadd /etc/samba/smb.conf '[global]' my new line
Appending a line to a [section] of a config file
command line;text processing;configuration;samba
You can do the task by sed directly, for example:sed '/^\[global\]/a\my new line' /etc/samba/smb.confNOTE: This is not a solution because such line can be in config already. So firstly you should to test whether is the line present.