Currently i am building one script to grep region records in the config file based on parameter and then i am creating a text file with that out put and i am reading the source file path in that out put file
now i need to pass one more parameter like module based upon that it has to create a text file
my script
#!/bin/bash
SOURCE_CONF="./test.properties"
#input region name
region="$1"
echo $region
cwd=$(pwd)
calu=$(grep $region test.properties > ab.txt)
IFS=$'\n'
#loop to read the config one line at a time
while read p; do
echo $p
a=($(echo "$p" | tr '|' '\n'))
echo "Region is:" "${a[0]}"
echo "path is:""${a[3]}"
path="${a[3]}"
#remove white space before path
echo $cwd
NO_LEAD_SPACE="$(echo -e $path | tr -d '[:space:]')"
echo "path is:"$NO_LEAD_SPACE
# change to path spacified in the config file
sh -c 'cd $NO_LEAD_SPACE && echo "in the subshell" && echo $pwd && echo "exit subshell" && exec pwd'
echo $cwd
echo "--------------------"
done < ab.txt
echo "abc"
my config file
region | Module |country code | filepath |filename
APJ | WDMD | MYS |/c/Users/vattikun/desktop | MYS*ADPGV*.XML
APJ | WDED | EUR|/c/Users/vattikun/desktop/Payroll Support | EUR*ADPGV*.XML
APJ | WDMD | RER|/c/Users/vattikun/desktop/Payroll Support | RER*ADPGV*.XML
APJ | WDJD | EYZ|/c/Users/vattikun/desktop/Payroll Support | EYZ*ADPGV*.XML
EMA | WDMD | AUS|/c/Users/vattikun/desktop | AUS*ADPGV*.XML
EMA | WDMD | AYS| /c/Users/vattikun/desktop | AYS*ADPGV*.XML
AMS | WDMD |ITI| /c/Users/vattikun/desktop | ITI*ADPGV*.XML
AMS |WDMD |AYS| /c/Users/vattikun/desktop | AYS*ADPGV*.XML
ETIME | WDMD |ADP /c/Users/vattikun/desktop | ADP_WDET_JOBCODE*.XML
ETIME | WDMD |AEP| /c/Users/vattikun/desktop | AEP_WDET_JOBCODE*.XML