![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| extract the lines between specific line number from a text file | return_user | Shell Programming and Scripting | 1 | 07-18-2009 10:11 PM |
| Extract specific lines for graphing | genehunter | UNIX for Dummies Questions & Answers | 1 | 06-21-2009 01:51 AM |
| extract lines based on few conditions | prvnrk | Shell Programming and Scripting | 4 | 10-17-2008 06:24 AM |
| extract some specific text file urgent pls | reyazan | UNIX for Dummies Questions & Answers | 2 | 10-20-2005 10:36 AM |
| extract specific lines from file | apalex | UNIX for Dummies Questions & Answers | 2 | 05-15-2001 10:57 AM |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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: Code:
<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> 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... |
| Bookmarks |
| Tags |
| data, extract, keyword, line, specific |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|