Sponsored Content
Top Forums Shell Programming and Scripting How to change values in datafile from source file Post 302448408 by ygemici on Thursday 26th of August 2010 02:24:17 AM
Old 08-26-2010
Code:
#!/bin/bash
IFS=$'\n'
for i in $(sed "" source)
 do
   x=$(echo "$i" | sed 's/ .*$//')
   y=$(echo "$i" | sed 's/^.* //')
sed -i "/$x/s/.*/<fld n=\"$x\" v=\"$y\" \/\>/" infile.txt
 done

<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE cmdf SYSTEM "cmdf.dtd">
<cmdf release="20" releaseECP="35.0" snId="5" date="201004190430CDT" >
<frame release="20" releaseECP="35.0" n="FMSFrameId" v="2" >
<entitytype n="FMSFrame" >
<entity >
<keyfld n="hdrsnId" v="5" />
<keyfld n="FMSFrameId" v="2" />
<fld n="hdrRouterIPAddress1" v="0.0.0.0" />
<fld n="hdrRouterIPAddress2" v="0.0.0.0" />
<fld n="hdrEthernetSwitch1IPAddress" v="112.13.9.34" />
<fld n="hdrEthernetSwitch2IPAddress" v="112.13.8.245" />
<fld n="subnetMask" v="104" />
<fld n="colorCode" v="2" />
<fld n="hdrcFMSVCVMIPAddress" v="172.27.11.232" />
<fld n="systemIdentifier" v="1" />
<fld n="ta13ReqTimer" v="2.0" />
<fld n="frameType" v="R1SRFrame" />
<fld n="asrtRptCtrl" v="Enabled" />
<fld n="asrtThrotCtrl" v="Enabled" />
<fld n="cpHighOccRptCtrl" v="Disabled" />
<fld n="cpfailAsrtLogCtrl" v="Enabled" />
<fld n="cpExcepRptCtrl" v="Disabled" />
<fld n="pcmdEvdoEnable" v="Disabled" />
<fld n="pcmdEvdoNormConn" v="Disabled" />
<fld n="pcmdEvdoNormSess" v="Disabled" />
<fld n="pcmdEvdoRUM" v="Enabled" />
<fld n="pcmdEvdoFlow" v="Enabled" />
<fld n="revASLKey" v="1025693969d79fdef19d10c7bb1e794f4f42" />
<fld n="revAActFlag" v="Activate" />
<fld n="noOfRevASLAvailable" v="8000" />
<fld n="noOfRevASLInUse" v="122" />
<fld n="maxDOSPayload" v="7777" />
<fld n="enable65KUATISessionsPerOHM" v="Yes" />
<fld n="enable128KUATISessionsPerOHM" v="No" />
<fld n="auxRNCCtrl1" v="0" />
<fld n="orcaOMCRANenabled" v="Yes" />
<fld n="auxRNCCtrl2" v="0" />
<fld n="auxRNCCtrl3" v="0" />
<fld n="auxRNCCtrl4" v="0" />
<fld n="intraRNCUATIBalanceEnable" v="No" />
<fld n="intraRNCUATISessionReptEnable" v="Yes" />
<fld n="intraRNCUATIBalanceThreshold" v="70" />
<fld n="uatiOverloadThreshold" v="95" />


Last edited by ygemici; 08-26-2010 at 03:37 AM..
This User Gave Thanks to ygemici For This Post:
 

10 More Discussions You Might Find Interesting

1. UNIX Desktop Questions & Answers

Change time source?

I need to change the time on my SUN box, it is five minutes fast. (4 Replies)
Discussion started by: michelemcdonald
4 Replies

2. Shell Programming and Scripting

Change the Values in a file

I have a data file. I want to write a shell script that reads a data file and reads position 19 thru 24. if the data in those fields is 002006, than it should change it to 002007. example: hello world hello 002006 hello world hello world hello world hello 002005 hello world hello world... (6 Replies)
Discussion started by: rudoraj
6 Replies

3. Shell Programming and Scripting

Combine a datafile with Master datafile, emergent!

Hi guys, my supervisor has asked me to solve the problem in 7 days, I've taken 3 days to think about it but couldn't figure out any idea. Please give me some thoughts with the following problem, I have index.database that has only index date: 1994 1995 1996 1997 1998 1999 I have... (6 Replies)
Discussion started by: onthetopo
6 Replies

4. Shell Programming and Scripting

to parse (or grep) a number from a datafile and write it to tab limited file

Hi All, I have a folder that contain 100's of subfolders namely: Main folder -> GHFG - Subfoders ->10 100 234 102 345 .. .. ... (2 Replies)
Discussion started by: Lucky Ali
2 Replies

5. Shell Programming and Scripting

How do I change the values in a file?

TRASH_PATH:~/deleted/ MAX_VERSIONS:5 FILE_MAX_SIZE:1024 FOLDER_MAX_SIZE:8096 TRASH_MAX_SIZE:1024 LOG_MAX_SIZE:100 how do i change the value of TRASH_MAX_SIZE to 2040 using the script? the filename is config.ini please advice Use code tags, ty. (5 Replies)
Discussion started by: classic
5 Replies

6. UNIX for Dummies Questions & Answers

Iptables to change source IP

Hey everyone! I am trying to configure iptables/netfilter so that all traffic coming from a certain port (8001) has its source ip re-written as a different ip. Can this be done? Basically its a possible workaround for another issue I'm having with a multihomed server. SNMP data is coming in on... (3 Replies)
Discussion started by: msarro
3 Replies

7. Shell Programming and Scripting

sorting the datafile in an order given in second datafile

Hi, I have two files: first input file is having 7-8 columns, and second data file is like I want to arrange my datafile1 in the order given in second data file, by comparing the seconddatafile with the second column of first file and print the entire line....also if any... (2 Replies)
Discussion started by: CAch
2 Replies

8. Shell Programming and Scripting

How to change certain values in a file

Hi all, i need help to replace certain values in a file. I need the script to check and match the ID and exNum1. if match, values in $3 (file2.txt) need to replace the value for 'START' (file1.txt) for each match. The sample structure is like this:- File1.txt ID P_6 START ... (4 Replies)
Discussion started by: redse171
4 Replies

9. Shell Programming and Scripting

Change values in .conf file with a script

This is my first time posting here...so be gentle. Suppose I have a test.conf file that contains a value such as a IP. I would like to be able to use the Dialog Utility in Linux to allow me to enter the new IP in a Dialog form...and the results get saved into the test.conf file in the place... (4 Replies)
Discussion started by: calahanp
4 Replies

10. UNIX for Beginners Questions & Answers

How to change values in xml file?

I have xml file like below, i want change the values at default-value place of each argument name using shell script. like where argument name= protocol and default-value=tcp, where argument name =port and default-value= 7223, where argument name = username and default-value=test, example ... (12 Replies)
Discussion started by: s1s2s3s4
12 Replies
All times are GMT -4. The time now is 10:36 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy