Split HTML text file in two parts using linux scripting

Issue

This Content is from ask ubuntu. Question asked by Goural

I have a html file, I want to split it in two parts. Below is my html text file –
Original

<p class="auto-cursor-target"><br /></p><table><tbody><tr><th><p>Name</p></th><th><p>Creation Date</p></th><th><p>ID</p></th><th><p>Comments</p></th></tr><tr><td><p>Ubuntu-18.04</p></td><td><p>Thu Sep 15 12:20:42 UTC 2022</p></td><td><p>12345</p></td><td><p>this_is_a_custom_comment</p></td></tr><tr><td><p>Ubuntu-18.04-16437838</p></td><td><p>Thu Sep 15 12:40:06 UTC 2022</p></td><td><p>56789</p></td><td><p>custom_comment</p></td></tr><tr><td><p>Ubuntu-18.04-2343</p></td><td><p>Thu Sep 15 13:03:04 UTC 2022</p></td><td><p>9876</p></td><td><p>custom_comment</p></td></tr></tbody></table><p class="auto-cursor-target"><br /></p>

After split –
Part 1

<p class="auto-cursor-target"><br /></p><table><tbody><tr><th><p>Name</p></th><th><p>Creation Date</p></th><th><p>ID</p></th><th><p>Comments</p></th></tr>

Part 2

<tr><td><p>Ubuntu-18.04</p></td><td><p>Thu Sep 15 12:20:42 UTC 2022</p></td><td><p>12345</p></td><td><p>this_is_a_custom_comment</p></td></tr><tr><td><p>Ubuntu-18.04-16437838</p></td><td><p>Thu Sep 15 12:40:06 UTC 2022</p></td><td><p>56789</p></td><td><p>custom_comment</p></td></tr><tr><td><p>Ubuntu-18.04-2343</p></td><td><p>Thu Sep 15 13:03:04 UTC 2022</p></td><td><p>9876</p></td><td><p>custom_comment</p></td></tr></tbody></table><p class="auto-cursor-target"><br /></p>


Solution

This question is not yet answered, be the first one who answer using the comment. Later the confirmed answer will be published as the solution.

This Question and Answer are collected from askubuntu, is licensed under the terms of CC BY-SA 2.5. CC BY-SA 3.0. CC BY-SA 4.0.

people found this article helpful. What about you?