[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]
Re: OT: Sed/Perl script tp comment out specifc line
- From: Matthew Melvin <matthewm webcentral com au>
- To: Chuck <redhat clinicomp com>
- Cc: <redhat-list redhat com>
- Subject: Re: OT: Sed/Perl script tp comment out specifc line
- Date: Sat, 1 Sep 2001 12:06:43 +1000 (EST)
On Fri, 31 Aug 2001 at 3:27pm (-0700), Chuck wrote:
>
> I have about 200 remote servers that run a custom application each with
> a tailored config file (ie no two are the same). I need to comment out 2
> lines that are the same in every file for all 200 servers. What is the
> easiest way to do this? I currently use rsh to manage these servers so I
> wanted to create a script, either in perl or sed, that can modify the
> file, distribute this script to each host and execute it there.
>
> How would you guys go about this?
>
> Thanks,
> CC
Hmmm... had to do this yesterday to add a new entry to the hosts.allow file
of a bunch of servers. Should be able to do it all on the command line
rather than distributing a script. Something like...
# cat hosts.list | while read i; do
> echo $i
> rsh $i "perl -p -i~bak -e 's/^(first line|second line)/#\$1/' cfgfile"
> done
host1
host2
[...]
host200
#
... shoudl work. Although i've only done this with ssh rather than rsh but
i'm 99% sure they're going to behave the same.
M.
--
WebCentral Pty Ltd Australia's #1 Internet Web Hosting Company
Level 1, 96 Lytton Road. Network Operations - Systems Engineer
PO Box 4169, East Brisbane. phone: +61 7 3249 2500
Queensland, Australia. pgp key id: 0x900E515F
[Date Prev][Date Next] [Thread Prev][Thread Next]
[Thread Index]
[Date Index]
[Author Index]