I have below two variables: $var1 which has value like
ABC
XYZ
SDF
and $var 2 which has value like
SDF
SGDGH
hfg
I want the output like
ABC
XYZ
SDF
SDF
SGDGH
hfg
I have the below script and i want to merger the value of file_import_2 and file_import_3 into one.
file_import_2=""
file_import_3=""
for DataBase in $(< "$1"); do
file_import_1=`grep -iw "CRQ_DI_PROD_$DataBase" "$Import_List_File" | grep -i prod`;
if [[ "$file_import_1" = GDH_* ]]; then
file_import_2=$file_import_1
fi
if [[ "$file_import_1" != GDH_* ]]; then
file_import_3=$DataBase
fi
var3=$(printf '%s\n%s\n' "$file_import_2" "$file_import_3")
echo $var3
done
The file i am passing to the script and Import_List_File have 4 values each
FARP_DATA_111
TRIN_STAGING
DBH
PRS
With the print f solution, output is:
CRQ_DI_PROD_FARP_DATA_111
CRQ_DI_PROD_TRIN_STAGING
CRQ_DI_PROD_TRIN_STAGING DBH
CRQ_DI_PROD_TRIN_STAGING PRS