i try to delete an whole tag in an xlf-file like:
<trans-unit id="test" resname="test"> <source>Panels</source> </trans-unit>
Is there a way delete from string
<trans-unit id="test" till string
I managed to delete two additional lines but it will be a problem on a multiline-value.
This is my current version:
sed -i.bak "/id=\"$KEY\"/,+2d" "$FILEPATH"
Since the file is well-indented, you can use a range pattern with
sed -i.bak '/<trans-unit id="'"$KEY"'"/,/<\/trans-unit>/d' "$FILEPATH"
The command will find all lines between a line that contains
<trans-unit id= + the ID in the
KEY variable, and then
" char, and a line that contains
</trans-unit>, and then will delete the found line range(s) (due to the