Sponsored Content
Full Discussion: NEED HELP
Top Forums Shell Programming and Scripting NEED HELP Post 302429784 by haiksuresh on Tuesday 15th of June 2010 01:40:58 PM
Old 06-15-2010
Question NEED HELP

Hi,
I have a folder which contains multiple config.xml files and one input file, Please see the below format.

Config Files format looks like :-
Code:
<application  name="SAMPLE-ARCHIVE">
      <NVPairs name="Global Variables">
        <NameValuePair>
            <name>MIG_Host</name>
            <value>217.171.101.225</value>
        </NameValuePair>
        <NameValuePairInteger>
            <name>MIG_Port</name>
            <value>8280</value>
        </NameValuePairInteger>       
  <services>
        <bw name="SAMPLE-ARCHIVE.par">
            <enabled>true</enabled>
            <bindings>
                <binding name="">
                    <machine>HOSTNAME</machine>
                    <product>
                        <type>bwengine</type>
                        <version></version>
                        <location></location>
                    </product>
                    <description></description>
                    <contact></contact>
               </binding>
            </bindings>
</services> 
</application>

INPUT FILE :-
Code:
MIG_Host,100.100.100.100
MIG_PORT,8080

Requirement :-

I need a shell script which should read the input file by each line and search for the first value in xml file and replace the value.

ex :-
search for "MIG_Host" in all xml files with in that folder and replace "217.171.101.225" value with "100.100.100.100"

In this way i need to apply each line to all xml files.

Thanks,
Suresh

Last edited by Scott; 06-15-2010 at 02:44 PM.. Reason: Removed formatting, added code tags
 
IO::Digest(3)						User Contributed Perl Documentation					     IO::Digest(3)

NAME
IO::Digest - Calculate digests while reading or writing SYNOPSIS
use IO::Digest; # Get a Digest::MD5 object that takes input while $fh being written or read my $fh; my $iod = IO::Digest->new ($fh, 'MD5'); print $fh "fooo"; print $iod->hexdigest DESCRIPTION
This module allows you to calculate digests while reading or writing file handles. This avoids the case you need to reread the same content to compute the digests after written a file. TEST COVERAGE
----------------------------------- ------ ------ ------ ------ ------ ------ File stmt branch cond sub time total ----------------------------------- ------ ------ ------ ------ ------ ------ blib/lib/IO/Digest.pm 100.0 n/a n/a 100.0 100.0 100.0 Total 100.0 n/a n/a 100.0 100.0 100.0 ----------------------------------- ------ ------ ------ ------ ------ ------ AUTHORS
Chia-liang Kao <clkao@clkao.org> COPYRIGHT
Copyright 2004 by Chia-liang Kao <clkao@clkao.org>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See <http://www.perl.com/perl/misc/Artistic.html> perl v5.18.2 2013-02-16 IO::Digest(3)
All times are GMT -4. The time now is 05:53 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy