Scripting /etc/fstab changes

Danda, Richard SFC richard.danda at us.army.mil
Tue Dec 5 22:29:05 UTC 2006


Thanks for all the help!! Looks like sed is the ticket. Guess I need to get
a good sed book!!

V/R

Richard J. Danda II
SFC, USA
BLCSE Network Manager/IASO
Maneuver Support Battle Lab
Fort Leonard Wood, MO
richard.danda at us.army.mil
 
 

-----Original Message-----
From: redhat-list-bounces at redhat.com [mailto:redhat-list-bounces at redhat.com]
On Behalf Of inode0
Sent: Tuesday, December 05, 2006 4:25 PM
To: General Red Hat Linux discussion list
Subject: Re: Scripting /etc/fstab changes

On 12/5/06, Gaddis, Jeremy L. <jeremy at linuxwiz.net> wrote:
> On 12/5/06, David Tonhofer <d.tonhofer at m-plify.com> wrote:
>
> > Try this perl script, it's probably unelegant as hell but I found it 
> > in my "hacks" directory.
> > No guarantees!!! Try it first manually, then set reallyWrite to 1 to 
> > replace your fstab.
>
> Why a huge script when you can easily do it with a sed one-liner?
>
> sed -i -e 's/^hostA/hostB/g' /etc/fstab

Or to rewrite /etc/fstab in place with perl at least something like

perl -p -i -e s/hostA/hostB/ /etc/fstab

John

--
redhat-list mailing list
unsubscribe mailto:redhat-list-request at redhat.com?subject=unsubscribe
https://www.redhat.com/mailman/listinfo/redhat-list




More information about the redhat-list mailing list