Need help to call shell script

Hi All,

Need one help on below:

I have one shell script(script name: s1_load) . Which has been scheduled based on parameters to load data into multiple tables at multiple intervals as below:

Script name schedule_timing parameter load_table_name
s1_load 08:00 mt mt
s1_load 08:30 st st
s1_load 09:00 vt vt
s1_load 09:30 nt nt

Now the requirement is that I need to load data into new materialized views based on above tables. for e.g. load data in mview_sn. which will use tables st and nt. Similarly need to load data in mview_msn which will use tables mt, st, nt.
Also main thing is that I need to load data as when the tables got loaded. for e.g when st and nt got loaded then immediately call should be made to load data in materialized view mview_sn. Similar thing required for mview_sn.

Need your suggestion. what is the best method to achieve this.

Hello ram29singh,

your question needs to be more detailed. so let me ask you where these tables are? is it a csv file or what?
I will assume that you are using a CSV file and I will give you sume tips in writing the csv files bu bash,
first you can use even echo or printf functions to print the values.

echo "$host, `date`, checkout,$Time_checkout" >> log.csv
echo "$host, `date`, add, $Time_add" >> log.csv
echo "$host, `date`, cimmit, $Time_commits" >> log.csv
printf "$host\t$(date)\tTime Taken to checkout\t$Time_checkout\n" >> log.csv
printf "$host\t$(date)\tTime Taken to add $loopmax 10MB svn files\t$Time_add\n" >> log.csv
printf "$host\t$(date)\tTime Taken to commit $loopmax 10MB svn files\t$Time_commit\n" >> log.csv

second to print the updateed value you can use AWK or sed function too as :

awk -F, 'NR > 1 { print $3 "," $4 "," $5 }' 

NR is the current line number, while $3, $4 and $5 are the fields separated by the string given to -F

you can check tis link that describes alot of ways to work with csvs by bash.

KodeKloud support