Sponsored Content
Top Forums Shell Programming and Scripting How to take input from user or awk script? Post 302460478 by Ganesh Khandare on Wednesday 6th of October 2010 11:55:18 PM
Old 10-07-2010
Sample of Properties file and filename

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
Code:
#!/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~T~~20091009~20091009~20101008~21180000~21180000~1.1893~1.1893~0~1~~

Last edited by vbe; 10-08-2010 at 07:46 AM.. Reason: code tags
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

awk user input

Using the following I'm trying to print the user's response to the prompt Y / N but I get nothing other than the contents of $1? awk '{ printf($1 " ? (Y/N)") getline myresponse < "-" system("read myresponse") if (myresponse == "Y") { print $1... (17 Replies)
Discussion started by: gefa
17 Replies

2. Shell Programming and Scripting

AWK set FILENAME via user input

I am trying to write a awk script that prompts user for input to set the FILENAME varable. I can get it set, but I think awk is not doing anything with it. this is what I have so far #!/usr/bin/nawk -f BEGIN { FILENAME = "" printf "Enter name of file to check in : " ... (2 Replies)
Discussion started by: timj123
2 Replies

3. Shell Programming and Scripting

User input for execution of script

Hi, I need to get the user input and execute a particular script based on the input provided. For E.g. When I execute the script say Test.sh it should prompt "For which country I need to execute the script? (US/India)" Based on the input as US or India from the user the execution of... (8 Replies)
Discussion started by: yoursdavinder
8 Replies

4. Shell Programming and Scripting

User Input Shell Script

Hello I am trying to create a user input shell scipt. The objective is user should enter the circuit number and the input is saved in a log file. If the user does not enter anything then the question should prompt it until the circuit no. is entered. Can any one please correct the code below.... (3 Replies)
Discussion started by: sureshcisco
3 Replies

5. Shell Programming and Scripting

Awk replacing file with user input

this section of the awk code i have here takes file to work with from the user. the user specifies the file name from the command line and the file name is assigned to the variable $FLIST awk 'BEGIN { while((getline < "'${FLIST}'")>0) S FS="\n"; RS="}\n" } now, i dont want... (5 Replies)
Discussion started by: SkySmart
5 Replies

6. Shell Programming and Scripting

Script interacts with user , based on user input it operates

i have a script which takes input from user, if user gives either Y/y then it should continue, else it should quit by displaying user cancelled. #!/bin/sh echo " Enter your choice to continue y/Y OR n/N to quit " read A if then echo " user requested to continue " ##some commands... (7 Replies)
Discussion started by: only4satish
7 Replies

7. Shell Programming and Scripting

User input and run awk using the input

I am trying to allow a user to enter in text and then store that text in a variable $gene to run in an awk command in which those values are used to run some calculations. I am getting syntax errors however, when I try. Thank you :). The awk runs great if it is a pre-defined file that is used,... (7 Replies)
Discussion started by: cmccabe
7 Replies

8. Programming

Keyboard User Input in awk language ?

Hi, does someone know how to make a keyboard data input in the AWK programming language ? Regards Zabo (6 Replies)
Discussion started by: Zabo
6 Replies

9. Shell Programming and Scripting

Help Me. The script should not exit until the user gives an input.

Hi everyone, I'm new here and just a beginner in linux scripting. Just want to ask for help on this one. I am trying to create a script that will accept user input (year-month and user/s). I wanted to have the script to continue running, until the user inputs a DATE and name/s of user/s. ... (2 Replies)
Discussion started by: Helskadi
2 Replies

10. Shell Programming and Scripting

awk command to search based on 5 user input fields

Field1=”” Field2=”” Field3=”” Field4=”” Field5=”” USER INPUT UP TO 5 FIELDS awk -F , '{ if ( $3 == Field1 && $6 == Field2 && $8 == Field3 && $9 == Field4 && $10 == Field5) print $0 }' /tmp/rodney.outD INPUT FILE (Rodney.outD): ... (3 Replies)
Discussion started by: rmerrird
3 Replies
Test::LectroTest::RegressionTesting(3pm)		User Contributed Perl Documentation		  Test::LectroTest::RegressionTesting(3pm)

NAME
Test::LectroTest::RegressionTesting - How to do regression testing (for free!) SYNOPSIS
use Test::LectroTest regressions => "regressions.txt"; # -- OR -- use Test::LectroTest playback_failures => "regression_suite_for_my_module.txt", record_failures => "failures_in_the_field.txt"; # -- OR -- use Test::LectroTest::Compat regressions => "regressions.txt"; # -- OR -- use Test::LectroTest::Compat playback_failures => "regression_suite_for_my_module.txt", record_failures => "failures_in_the_field.txt"; DESCRIPTION
Say that LectroTest uncovers a bug in your software by finding a random test case that proves one of your properties to be false. If you apply a fix for the bug, how can you be sure that LectroTest will re-test the property using the exact same test case that "broke" it before, just to be certain the bug really is fixed? And how can you be sure that future changes to your code will not reintroduce the same bug without your knowing it? For situations like these, LectroTest can record failure-causing test cases to a file, and it can play those test cases back as part of its normal testing strategy. The easiest way to take advantage of this feature is to set the regressions parameter when you "use" Test::LectroTest or Test::LectroTest::Compat: use Test::LectroTest regressions => "regressions.txt"; This tells LectroTest to use the file "regressions.txt" for both recording and playing back failures. If you want to record and play back from separate files, use the record_failures and playback_failures options: use Test::LectroTest::Compat playback_failures => "regression_suite_for_my_module.txt", record_failures => "failures_in_the_field.txt"; Here is how it works: 1. When testing a property named N, LectroTest will check for a play-back file. If the file exists, LectroTest will search it for test cases associated with N. If any such test cases exist, LectroTest will play them back before and in addition to performing the usual, random testing of the property. 2. When performing the usual, random testing of a property named N, if a failure occurs (i.e., LectroTest finds a counterexample), LectroTest will record the test case that caused the failure to the recording file, associating the test case with the name N. NOTE: If you pass any of the recording or playback parameters to Test::LectroTest::Compat, you must have version 0.3500 or greater of Test::LectroTest installed. (Module authors, update your modules' build dependencies accordingly.) The Test::LectroTest module itself, however, has always ignored unfamiliar parameters, and thus these options are backward compatible with older versions. SEE ALSO
Test::LectroTest gives a quick overview of automatic, specification-based testing with LectroTest. This module accepts failure recording and play-back options. Test::LectroTest::Compat lets you mix LectroTest with the popular family of Test::Builder-based modules such as Test::Simple and Test::More. This module accepts failure recording and play-back options. LECTROTEST HOME
The LectroTest home is http://community.moertel.com/LectroTest. There you will find more documentation, presentations, mailing-list archives, a wiki, and other helpful LectroTest-related resources. It's also the best place to ask questions. AUTHOR
Tom Moertel (tom@moertel.com) COPYRIGHT and LICENSE Copyright (c) 2004-06 by Thomas G Moertel. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.3 2007-08-30 Test::LectroTest::RegressionTesting(3pm)
All times are GMT -4. The time now is 12:03 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy