Timeline for sed inline not working to modify XML-style input
Current License: CC BY-SA 4.0
5 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Mar 2, 2024 at 14:19 | comment | added | Ed Morton | @AllanTori -r is the old GNU sed option that's now replaced by -E, don't mix them. You don't need 2 separate sed commands anyway though as sed 'foo' | sed 'bar' is usually equivalent to sed 'foo; bar'. | |
| Feb 28, 2024 at 17:57 | comment | added | Allan Tori | thank a lot , have make a new script this work fine : sed -r 's/\b(Documents|time|Commun|Current|CurrentTitle)\b//g' tracklist1.txt | sed -E 's|(<file>).*/([^/]+</file>)|\1\2|' > newtracklist.txt | |
| Feb 27, 2024 at 21:57 | comment | added | markp-fuso | did you see the parts ... there are better tools for parsing HTML/XML, if OP must use sed .... this works for the specific input provided by OP; there are a slew of ways this answer breaks if the format of OP's input differs from that provided in the sample, and OP will find out real quickly should they actually run into such a situation | |
| Feb 27, 2024 at 21:28 | comment | added | Gilles Quénot | Nice, but OP use the wrong tool ^^ What if the closing tag is on a newline? This is would be a perfectly valid XML. | |
| Feb 27, 2024 at 21:17 | history | answered | markp-fuso | CC BY-SA 4.0 |