Re: How to programmatically modify configuration files?

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

 



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!

Attachment: signature.asc
Description: OpenPGP digital signature

-- 
fedora-list mailing list
fedora-list@xxxxxxxxxx
To unsubscribe: https://www.redhat.com/mailman/listinfo/fedora-list
[Index of Archives]     [Older Fedora Users]     [Fedora Announce]     [Fedora Package Announce]     [EPEL Announce]     [Fedora Magazine]     [Fedora News]     [Fedora Summer Coding]     [Fedora Laptop]     [Fedora Cloud]     [Fedora Advisory Board]     [Fedora Education]     [Fedora Security]     [Fedora Scitech]     [Fedora Robotics]     [Fedora Maintainers]     [Fedora Infrastructure]     [Fedora Websites]     [Anaconda Devel]     [Fedora Devel Java]     [Fedora Legacy]     [Fedora Desktop]     [Fedora Fonts]     [ATA RAID]     [Fedora Marketing]     [Fedora Management Tools]     [Fedora Mentors]     [SSH]     [Fedora Package Review]     [Fedora R Devel]     [Fedora PHP Devel]     [Kickstart]     [Fedora Music]     [Fedora Packaging]     [Centos]     [Fedora SELinux]     [Fedora Legal]     [Fedora Kernel]     [Fedora OCaml]     [Coolkey]     [Virtualization Tools]     [ET Management Tools]     [Yum Users]     [Tux]     [Yosemite News]     [Gnome Users]     [KDE Users]     [Fedora Art]     [Fedora Docs]     [Asterisk PBX]     [Fedora Sparc]     [Fedora Universal Network Connector]     [Libvirt Users]     [Fedora ARM]

  Powered by Linux