I try to replace string in XML file with sed, but since its regular expression doesn't support non-greedy expressions, I encounter a problem.
XML Example:
<opt>
<Node active="yes" file="/home/user/random_filename" last_time="17/07/14-00:02:07" time_in_min="5" />
</opt>
I want to find the file attribute, which is random string, and replace it with another string.
This command replaces the string, BUT removes the trailing data.
sed 's/file=".*"/file="new_file_name"/' file.xml
Output:
<opt>
<Node active="yes" file="new_file_name" />
</opt>
How should I handle it?