I have input like below
<tag col1 = "" col2 = "" >
<Data>
</tag end>
<tag1 col1 = "" col2 = "" col3 = "" > Here col1 can have some data(like col1 = "Data can be available") or it cane be empty (like col1 = "")
<data>
</tag1>
<tag2 col1 = "" col2 = "" >
<Data>
</tag2>
OutPut like below
<tag>
<Data>
</tag>
<tag1 col1 = "Updated Comments" col2 = "" col3 = "" >
<data>
</tag1>
<tag2 col1 = "" col2 = "" >
<Data>
</tag2>
I need to update just col1 on tag1 with updated comments and input can be empty or can have some other characters for col1 but I need to replace that col1 alone with updated comments
I tried below but it is now working as expected. If I am trying below one the other values (col2 = "" etc) in the line is getting truncated
sed -e 's/tag1 col1 =".*"/col1 =\"Updated Comments\"/' test_file.txt