Sponsored Content
Top Forums Shell Programming and Scripting Report a missing property and property value mis match script. Post 302549655 by Corona688 on Tuesday 23rd of August 2011 02:51:04 PM
Old 08-23-2011
Code:
awk -v MASTER="/path/to/master.file" -v FS="=" 'BEGIN {
        while(getline <MASTER)
        {
                if ( ($0 ~ /^[ \t]*#/) || ($0 == "") ) continue;

                if($2 != "")
                        SET[$1]=$2
        }
}

{
        if (!($0 ~ /^[ \t]*#/) && !($0 == "") )
        if(SET[$1] && (SET[$1] != $2))
                print "ERROR " $0;
}' < /path/to/local.file

---------- Post updated at 12:51 PM ---------- Previous update was at 12:34 PM ----------

Improved version:
Code:
awk -v FS="=" -v MASTER="/path/to/master" 'BEGIN { while(getline <MASTER)
        {
                if (($0 ~ /^[ \t]*#/) || ($0 == "")) continue;
                INMASTER[$1]=1;         VAL[$1]=$2;
        }
}

{       if (!($0 ~ /^[ \t]*#/) && !($0 == "") ) LOCAL[$1]=$2;   }

END {   for(k in INMASTER)
        {
                if((VAL[k] == "") && (LOCAL[k] == ""))  print "UNSET " k;
                if((VAL[k]!="") && (LOCAL[k] != VAL[k])) print "OVERRIDDE " k;
        }
}' < /path/to/local

With your input data, and db.port.2=1521 modified to 1522, I get:

Code:
UNSET jboss.proxy.name
OVERRIDDE db.port.2

This User Gave Thanks to Corona688 For This Post:
 

7 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Problem printing the property of xml file via shell script

Hi, I have a config.xml which cointains the tags like <CONFIG> <PROPERTY name="port" value="1111"/> <PROPERTY name="dbname" value="ABCDE"/> <PROPERTY name="connectstring" value="xyz/pwd"/> </CONFIG> This file is in some directory at UNix box. I need to write a... (4 Replies)
Discussion started by: neeto
4 Replies

2. Shell Programming and Scripting

source a property file in script give error

I have sourced a property file in my script like this to load some variables in the script Then i am able to echo all the property file values inside script but the script is not able to recognize other unix commands #!/bin/bash . build.properties mkdir build i am getting error ... (3 Replies)
Discussion started by: codeman007
3 Replies

3. Shell Programming and Scripting

URGENT: Script/Function needed to read text property files in block wise

Hi, Iam in a need for a script/function in KSH where I want to read a text file (property file) in block by block. Here is the example: Heading Name Descripton Block Block1 Value1 Description Property Name Value Property Name Value Property Name Value Property Name Value Property Name... (7 Replies)
Discussion started by: ysreenivas
7 Replies

4. Shell Programming and Scripting

Script to update Property Entry Values

Hi All, I'm Raghavendra. I have a very urgent requirement to develop a Shell Script which will allow to use variables in a property file as demonstarted below var1=UNIX var2=LINUX var3=WINDOWS var4=$var1,$var2 var5=$var3 Could you please help me to develop a shell script which can... (2 Replies)
Discussion started by: raghavstunner
2 Replies

5. Shell Programming and Scripting

To read xml value depending on property

Hi have some xml like this <example> <Cell Name="Cell1" ConfigureHost="claas" Role="APPSERV,BACKEND"> <Node Name="aaaaa" Role="APPSERV,BACKEND,CLM"/> <Node Name="vvvv" Role="APPSERV,BACKEND"/> <Mercury Type="default" FQDN="ssssss" PrimaryReturnFQDN=""/> </Cell> ... (1 Reply)
Discussion started by: javaholics
1 Replies

6. Shell Programming and Scripting

Reading a property file through shell script???

Hi! i need a script that can read a property file. i.e., A script to read a "property" from property file. Read the property value and based on value of property, decide whether to start the some dataload activity or not. Its urngent. Can anyone help me out???:( (7 Replies)
Discussion started by: sukhdip
7 Replies

7. Shell Programming and Scripting

Not to remove Files based on property value

Hi All, Need your help to fix one script. Main agenda is: 1. Read a property file. 2. Delete all files in directory except the name from Property file. I am trying to read property file for value then deleting all files from directory except THAT value/name. I have tried so far as... (3 Replies)
Discussion started by: sukhdip
3 Replies
MASTER(8)						      System Manager's Manual							 MASTER(8)

 *

NAME
master - master Cyrus process SYNOPSIS
master [ -C alternate imapd.conf ] [ -M alternate cyrus.conf ] [ -l listen queue ] [ -p pidfile ] [ -P snmp agentx ping interval ] [ -j janitor period ] [ -d ] [ -D ] [ -x snmp agentx socket ] DESCRIPTION
Master is the process that controls all of the Cyrus processes. This process is responsible for creating all imapd, pop3d, lmtpd and sieved child processes. This process also initializes the Berkeley DB code and performs scheduled cleanup/maintenance. If this process dies, then no new sessions will be started. It kills itself and all child processes when it receives a SIGTERM. OPTIONS
-C alternate imapd.conf Specifies an alternate imapd.conf for use by master (note that this will not affect any sub-processes spawned by master, you should specify those specifically in the respective entries in cyrus.conf). -M alternate cyrus.conf Specifies an alternate cyrus.conf for use by master. -l listen queue backlog Increase the listen queue backlog. By default, the listen queue is set to 32. On systems with a high connection rate, it may be desirable to increase this value. refer to listen(2) for details. -j janitor full-sweeps per second Sets the amount of times per second the janitor should sweep the entire child table. Leave it at the default of 1 unless you have a really high fork rate (and you have not increased the child hash table size when you compiled Cyrus from its default of 10000 entries). -p pidfile Use pidfile as the pidfile. If not specified, defaults to /var/run/cyrus-master.pid -P snmp agentx ping interval Sets the amount on time in seconds the subagent will try and reconnect to the master agent (snmpd) if it ever becomes (or starts) disconnected. Requires net-snmp 5.0 or higher. -d Start in daemon mode (run in background and disconnect from controlling terminal). -D Don't close stdin/stdout/stderr. Primiarly useful for debugging. -x snmp agentx socket Address the master agent (most likely snmpd) listens on. Requires net-snmp 5.0 or higher. CONFIGURATION
Upon execution, master reads its configuration information out of the cyrus.conf(5) file. Master rereads its configuration file when it receives a hangup signal, SIGHUP. Services and events may be added, deleted or modified when the configuration file is reread. Any active services removed from the configuration file will be allowed to run until completion. NOTES
The environment variable CYRUS_VERBOSE can be set to log additional debugging information. Setting the value to 1 results in base level logging. Setting it higher results in more log messages being generated. FILES
/etc/cyrus.conf, /etc/imapd.conf, /var/run/cyrus-master.pid SEE ALSO
cyrus.conf(5), imapd.conf(5), imapd(8), pop3d(8), lmtpd(8), timsieved(8), idled(8) CMU
Project Cyrus MASTER(8)
All times are GMT -4. The time now is 01:45 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy