I am trying to replace folder name value in an xml file.I am searching with required pattern using grep and replace the folder name value which is DF_GCSS with ABC_DEF which comes from a variable.Below mentioned statement i have used to replace only the folder name value but the output is not as expected.It is appending the variable data to the existing folder value
FLDR_NM=ABC_DEF grep -i "<FOLDER NAME" file_name.xml | sed 's/<FOLDER NAME="[Aa0-Zz9]"*/<FOLDER NAME="'$FLDR_NM'"/1g'
Output:
<FOLDER NAME="ABC_DEF"F_GCSS" GROUP="" OWNER="Administrator" SHARED="NOTSHARED" DESCRIPTION="" PERMISSIONS="rwx---r--" UUID="5ff15b2a">
Expected output:
<FOLDER NAME="ABC_DEF" GROUP="" OWNER="Administrator" SHARED="NOTSHARED" DESCRIPTION="" PERMISSIONS="rwx---r--" UUID="5ff15b2a">
F_GCSS
?