How to take input from user or awk script?

Hi Jim,
I have following script,i which i need to take dynamic value .
script,

nawk -v v1=grep"INT_EUR" $propertifilename | cut -d"=" -F2` -F'~' '{if (NF-1 !=v1)
{print "Error in " $0 " at line number "NR" tilde count " N-1}}' $filename

In the above script i want to use INT_EUR as a variable that means i want to take variable from property file only but there are 8 different constants.
As you know i am using properties file now the problem is that my boss want to
pass the variable to script in such a way that the script should recognize the variable and act according to that.

e.g .properties file contains
Both below variable belongs to sourcesystem=INTELLECT and region=EUR
sourcesystem=OPICS and region=TOK
INT_EUR1=14
INT_EUR2=51

these belongs to sourcesystem=OPICS
INT_TOK1=14
INT_TOK2=57

and so on.
Now my problem is i want to pass only sourcesystem and region to script so that script will recognize sourcesystem and region and work or that file only.

example: script name e.g new.sh INTELLECT EUR1
then script will check INTELLECT EUR1 file and count ~ for that file only if count wrong then gives an error with line number.

Could you please solve this problem.

Thanks & Regards,
Ganesh,

You only give the sample of file $propertifilename, but I don't see the format of file $filename

You need provide both of them, and your expect output.

Hi,
The sample of property file is
file name: Validation.properties

INTELLECT_EUR_DEAL_HANDOFFS=/cdirect/rtrupld/incoming/intellect/INTELLECT_EUR_MMRTRDEALS*.txt
INTELLECT_EUR_CASHFLOW_HANDOFFS=/cdirect/rtrupld/incoming/intellect/INTELLECT_EUR_MMRTRCASHFLOW*.txt
INTELLECT_TOK_DEAL_HANDOFFS=/cdirect/rtrupld/incoming/intellect/INTELLECT_EUR_MMRTRDEALS*.txt
INTELLECT_TOK_CASHFLOW_HANDOFFS=/cdirect/rtrupld/incoming/intellect/INTELLECT_TOK_MMRTRCASHFLOW*.txt
INTELLECT_NY_DEAL_HANDOFFS=/cdirect/rtrupld/incoming/opics/OPICSNY_NAM_MMRTRDEALS_EOD*.txt
INTELLECT_NY_CASHFLOW_HANDOFFS=/cdirect/rtrupld/incoming/opics/OPICSNY_NAM_MMRTRCASHFLOW_EOD*.txt
INTELLECT_CA_DEAL_HANDOFFS=/cdirect/rtrupld/incoming/opics/OPICSCA_NAM_MMRTRDEALS_EOD*.txt
INTELLECT_CA_CASHFLOW_HANDOFFS=/cdirect/rtrupld/incoming/opics/OPICSCA_NAM_MMRTRCASHFLOW_EOD*.txt

INTELLECT_EUR_DEAL_FLD_COUNT=51
INTELLECT_EUR_CASHFLOW_FLD_COUNT=14
INTELLECT_TOK_DEAL_FLD_COUNT=57
INTELLECT_TOK_CASHFLOW_FLD_COUNT=14
INTELLECT_NY_DEAL_FLD_COUNT=51
INTELLECT_NY_CASHFLOW_FLD_COUNT=14
INTELLECT_CA_DEAL_FLD_COUNT=51
INTELLECT_CA_CASHFLOW_FLD_COUNT=14

the above paths are given in which handoff are presents where each handoffs are two types like DEAL and CASHFLOW
so for DEAL for EUR 51 and for TOK 57 tilde counts and for cashflow 14 tilde counts .
now i want to pass parameter to script in such a way that it should take valuue of respective sourcesystem and region from property file and check whether count of each line is correct or not

OUTPUT required;
step 1:./scriptname param1 param2
e.g ./new.sh INTELLECT EUR
step2: at line 3 tild count is 15 so error in this line like that

--That means need to pass param1 as INTELLECT which is sourcesystem and param2 is EUR which region both are refers handoff location whos path is given in property file.

--handoff example i have given already.
--Could you please give right solution for it.
--at least give some idea about how to pass parameter to my script it would be helpfull for me.

Thanks & Regards,
Ganesh

---------- Post updated at 09:25 AM ---------- Previous update was at 09:22 AM ----------

Hi,
Handoff sample.
$profile is the path of data file like

#!/bin/bash
WORK_DIR=/export/opt/rtrupld/autosys/scripts_old
DATA_DIR=/cdirect/rtrupld/incoming/intellect/
#LOG=/export/opt/rtrupld/autosys/logs/impIntEurCshFlw.log
data=$DATA_DIR/INTELLECT_EUR_MMRTRCASHFLOW*.txt
propfile=$WORK_DIR/HandoffValidation.properties
 

--Handoff sample.
INTELLECT~EUR~EOD~34~2010-09-23 00:24:46~20100922~~~~~~~~~
INTELLECT~GB~2GB0928200180~1~T20091009~20091009~20101008~21180000~21180000~1.1893~1.1893~0~1