How to pass arguments based on input file?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to pass arguments based on input file?
# 8  
Old 01-20-2018
Thanks Don sorry for haven't clearly mentioned my assignment
its require here-document to complete assignment if will pass arguments then its generate reports
if we pass 2 times or may be 3 times different arguments then it will generate 2 or 3 reports to execute 2 or 3 times exe file

So we are doing manually as i mentioned above in the code to avoid this i want to put input file all arguments and run exe file so that it will generate the report below is the main syntax we are using for generate one report
Code:
 cd /u/kali/temp
 
${APPS}/kali/bin/u_tra <<EOD
CUSTOM
 
EOD

below code if we generate 2 or 3 report then we have to copy same thing 2 or 3 times with different arguments below custom keyword
while copy pest doing mistake please ignore my last comments

Code:
${APPS}/kali/bin/u_tra <<EOD
CUSTOM
18658
AQBCD
Squrt mob
  
EOD
${APPS}/kali/bin/u_tra <<EOD
CUSTOM
18995
COTSYN
Cot sys
  
EOD
${APPS}/kali/bin/u_tra <<EOD
CUSTOM
18789
COSTER
ctc resr
  
EOD

if will copy all arguments and keep in input file while script run then it will take the data from input file and generate
the reports to avoid manual process below is the input file format

Code:
18658
AQBCD
Squrt mob
18995
COTSYN
Cot sys
18789
COSTER
ctc resr

or
Code:
18658,AQBCD,Squrt mob
18995,COTSYN,Cot sys
18789,COSTER,ctc resr

I have not mentioed the shell command because of have mentioned small part of my scripts

Last edited by Kalia; 01-20-2018 at 10:41 AM..
# 9  
Old 01-20-2018
Moderator's Comments:
Mod Comment Homework and coursework questions can only be posted in the Homework & Coursework forum under special homework rules.

Please review the rules, which you agreed to when you registered, if you have not already done so.

If you did post homework in the main forums, please review the guidelines for posting homework and repost.

This thread is closed.
This User Gave Thanks to Don Cragun For This Post:
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Read file lines and pass line values as arguments.

Dears, Need help to implement below requirement A file (detail.txt)contain : 1st column: Stream 2nd column: PathAddress 3rd column: Counterlimit 4th column: TransactionDateColumn 5th column: DateType 6th column: SleepValue 7th column: Status Need to write a... (1 Reply)
Discussion started by: sadique.manzar
1 Replies

2. Shell Programming and Scripting

How pass the input parameter to a file in the script ?

OS version: RHEL 6.7 myTextFile.txt file is referred within Script1.sh script, I only execute Script1.sh and I want the input variable to be passed inside myTextFile.txt . Any idea how I can do this ? $ cat script1.sh cat myTextFile.txt $ cat myTextFile.txt $1 Requirement1.... (4 Replies)
Discussion started by: kraljic
4 Replies

3. Shell Programming and Scripting

Read input from file and pass it to sub shell

i have a scenario where in i have to monitor jobs which run in different servers, The job details(job name, host server, etc) are present in a dat file. I have written a script a script which reads the details from the dat file and calls a local method where the job monitoring logic is present.... (2 Replies)
Discussion started by: abubucker0
2 Replies

4. UNIX for Dummies Questions & Answers

To pass multiple arguments from file in to an sql query

Hi all , I want to pass contents from a file say f1 as arguments to a sql query which has In statement using a script example select * from table_1 where login in ( `cat f1`) ; will this work or is there any other way to do it. (1 Reply)
Discussion started by: zozoo
1 Replies

5. UNIX for Dummies Questions & Answers

Pass arguments to the library .so

Hello, Please, how can i pass arguments to my lib.so ? my lib.so is written in c and i need some arguments in the code .. LD_PRELOAD=lib.so ./program Thank you. (1 Reply)
Discussion started by: chercheur857
1 Replies

6. Shell Programming and Scripting

pass arguments unchanged

Hi, I have to use ksh on HP-UX for some scripting. I usually use "set -e -u" in scripts to stop if errors occur or a typo is in a variable name. Now I try to use "$@" to pass the arguments unchanged to another function, which works without problems - unless I try to call the script without... (7 Replies)
Discussion started by: michas
7 Replies

7. Shell Programming and Scripting

How to pass arguments to SQL file passed in shell script?

Hi, I am using SYBASE database. in my script i am connecting to DB via using isql. isql -U${S_USER} -S${S_SERV} -D${S_DB} -P${S_PWD} -b0 -w3000 -h0 -s"|" -i${MYDIR}/ABC.sql -oXYZ.txt << FINSQL i am taking a ABC.sql file to use the queries written in it and storing the output in... (3 Replies)
Discussion started by: dazdseg
3 Replies

8. Shell Programming and Scripting

Pass input and output file as parameter to awk script

Hi, i am new to awk. I am using csv2pipe script(shown below) BEGIN { FS=SUBSEP; OFS="|" } { result = setcsv($0, ",") print } # setcsv(str, sep) - parse CSV (MS specification) input # str, the string to be parsed. (Most likely $0.) # sep, the separator between the values. # #... (6 Replies)
Discussion started by: bhaskarjha178
6 Replies

9. UNIX for Advanced & Expert Users

Pass Kill with arguments

Dude, I want to kill a process, but the processid is in a text file. I have to read the text file for the process id and pass it as parameter to the kill command. Example $ cat prcid.txt 18650 I want to pass the value 18650 as a process id to kill command. $ kill -9 <value read from... (4 Replies)
Discussion started by: aksmuralee
4 Replies

10. Shell Programming and Scripting

read a file as input and pass each line to another script

Hi, I am trying to write a ftp script which will read a file for filenames and ftp those files to another server. Here's my ftp script, but it's scanning the current directory for file names. My question is how can I pass multiple files (these files will have the name of data files that need to... (0 Replies)
Discussion started by: sajjad02
0 Replies
Login or Register to Ask a Question