I am trying to use a regular expression to find and replace the contents that are enclosed by two double quotes in a xml file using sed
, e.g., "contents like this..."
.
In particular, I would like to replace whatever the content of autoLogoffTime
is with a fixed string "2:15,AM"
in the xml file.
Some contents of my XML file
<SystemSettings executionSummaryExportDir="/home/Jts/" autoLogoffTime="11:45,PM" repetitiveSnapshotDelay="500" snapshotCostReminderLimit="10" snapshotExcessiveUsageLimit="50" autoExportDirectory="/home/$
There are a few of these XML files in different directories that I would like to replace the string. The content of autoLogoffTime
can be with or without a space in it, e.g.:
autoLogoffTime="11:45,PM"
autoLogoffTime="11:45, PM"
I tried to find all the characters (white space and non-whitespace) by using *
but it does not seem the right regular expression.
sed -i.bak 's/autoLogoffTime="*"/autoLogoffTime="2:15,AM"/g' file.xml
could someone kindly help?