There is no OFS..this is an xml file. I apologize I should have mentioned that before. Only the pattern that I am looking for needs to be changed to lower case atleast.
---------- Post updated at 01:18 PM ---------- Previous update was at 01:14 PM ----------
This changes the whole file to lower case. I only need the pattern sc_DWSTAGE_<XYZ>INITIAL.bad to be changed to lower case: sc_dwstage<xyz>1.bad
So for example:
sc_DWSTAGE_AC_DBO_TBL_CONTENT_INITIAL
would need to change to:
sc_dwstage_ac_dbo_tbl_content1.bad
#!/bin/bash
declar -i i
i=1
while read -r LINE
do
case "$LINE" in
*"sc_DWSTAGE_"*)
end="${LINE##*INITIAL}"
front=${LINE%%sc_DWSTAGE*}
middle="sc_DWSTAGE${LINE#*sc_DWSTAGE}"
middle="${middle%_INITIAL*}$i"
LINE="${front}${middle,,}${end}"
;;
esac
echo "${LINE}"
done < "file"
The pattern does not exist in a line per se....it is part of the line...the problem I am having is that the pattern needs to be replaced with another pattern....The previous seems to be just putting it out to a file if i want to...
how do I replace something like
sc_DWSTAGE.*INITIAL.bad
to sc_DWSTAGE_.*1.bad where there can be more characters on the line...
so a sample line would be
<ATTRIBUTE NAME ="Reject filename" VALUE ="sc_DWSTAGE_XYZ_XYZ_XYZ_INITIAL.bad"/>
i want to replace to:
<ATTRIBUTE NAME ="Reject filename" VALUE ="sc_dwstage_xyz_xyz_xyz1.bad"/>