How to programmatically modify configuration files?
Mikkel L. Ellertson
mikkel at infinity-ltd.com
Thu Jul 26 02:19:42 UTC 2007
Sam Varshavchik wrote:
> Arch Willingham writes:
>
>> I have a script that does a bunch of installation stuff. It works well
>> but
>> I can't figure out how to modify some of the configuration files
>> (/etc/samba/smb.conf for example). Is there any easy command to do this?
>> For example, I'd like to change the file so that "workgroup = MYGROUP"
>> becomes "workgroup = ÁUBURN"
>>
>> Any suggestions?
>
> Write a Perl script to do this, or a shell script that runs sed:
>
> sed 's/^workgroup =.*/workgroup = ÁUBURN/'
>
> You have to be careful with whitespace. Also, you have to be sure that
> smb.conf is going to take the accented text.
>
>
I would use:
sed -i 's/^workgroup =.*/workgroup = ÁUBURN/' /etc/samba/smb.conf
or
sed -i -e 's/^workgroup =.*/workgroup = ÁUBURN/' /etc/samba/smb.conf
Mikkel
--
Do not meddle in the affairs of dragons,
for thou art crunchy and taste good with Ketchup!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/fedora-list/attachments/20070725/31df451a/attachment-0001.sig>
More information about the fedora-list
mailing list