The text in file looks like this:
[homes]
comment = Home Directories
path =
browseable =
writable = yes
valid users = %S
valid users = MYDOMAIN\%S
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes
I want output as:
[homes]
comment = Home Directories
path = /data
browseable = yes
writable = yes
valid users = %S
valid users = MYDOMAIN\%S
[printers]
comment = All Printers
path = /var/spool/samba
browseable = no
guest ok = no
writable = no
printable = yes
I am using this command:
sed -i "\#path# s#.*#& /data#" file
It makes changes to everywhere in file where path is located.
Can anyone help me with this?
path =
, you probably want to apply to thehomes
section only:sed '/\[homes/,/browsable/s#path =.*#path = /data#'
– Philippos Sep 21 '17 at 06:32