RE: How to programmatically modify configuration files?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Thanks Mikkel and Sam! BTW....I don't know how that funky Á got in there....I just typed a plain old A!

Arch

-----Original Message-----
From: fedora-list-bounces@xxxxxxxxxx
[mailto:fedora-list-bounces@xxxxxxxxxx]On Behalf Of Mikkel L. Ellertson
Sent: Wednesday, July 25, 2007 10:20 PM
To: For users of Fedora
Subject: Re: How to programmatically modify configuration files?


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!



[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux