I have variable $2 whose value is expdp_SDW_MSTR_VMDB.par
I want to replace three characters from right (par) with (log)
Input --> expdp_SDW_MSTR_VMDB.par
Output --> expdp_SDW_MSTR_VMDB.log
Thanks
Deep
I have variable $2 whose value is expdp_SDW_MSTR_VMDB.par
I want to replace three characters from right (par) with (log)
Input --> expdp_SDW_MSTR_VMDB.par
Output --> expdp_SDW_MSTR_VMDB.log
Thanks
Deep
var=expdp_SDW_MSTR_VMDB.par
newname=${var%%par}log
Note the use of the $ with the par$ in the sed command; this means to grab the text at the end of a line. Hence, the command did not change the par earlier in the text string.
> var=expdp_par_SDW_MSTR_VMDB.par
> var2=$(echo $var | sed "s/par$/log/")
> echo $var2
expdp_par_SDW_MSTR_VMDB.log