I regularly extract lines of text from files based on the presence of a particular keyword; I place the extracted lines into another text file. This takes about 2 hours to complete using the "sort" command then Kate's find & highlight facility.
I've been reading the forum & googling and can find scripts and shell commands which extract a particular string from a file but nothing that extracts a complete line based on a keyword/string within a line.
Here's an example of the lines of data I'm using:
<li><a href="http://some-website1.com/"><b>CategoryOne: </b>Description defgh</a></li>
<li><a href="http://some-website2.com/"><b>CategoryThree: </b>Description cdefg</a></li>
<li><a href="http://some-website3.com/"><b>CategoryTwo: </b>Description bcdef</a></li>
<li><a href="http://some-website3.com/"><b>CategoryOne: </b>Description abcde</a></li>
<li><a href="http://some-website2.com/"><b>CategoryOne: </b>Description zabcd</a></li>
The data is alway a list item.
I need something that will find the line containing a specified category which will then extract the complete line and move it to a new text file (preferably named after that category). For example:
If I search for "<b >CategoryOne</b >" then I need it to move every line containing "<b >CategoryOne</b >" to text file categoryone.txt
Please help...