Replace Pioneer Home   All Examples   Free Download

 New request --free  RSS: Replace Pioneer Examples

1004.Text file parser -- How to rip out all but line 1 and specified text?

User: Colin -- 2012-09-11          << 1003  1005 >>
Hits: 1509
Type: Text file parser   
Search all Text file parser examples
Description:
How to rip out all but line 1 and quiz scores?
I have 200 text files, How can I rip out everything leaving just line 1
and quiz 1 scores.
Input Sample:
Alexandir Magnitsiy 4355
PAT
     24.00/28.00 
   lesn1
     4 views
 quiz1 
     9.00/14.00 
      8.00/14.00 
      5.00/14.00 
      11.00/14.00 
      6.00/14.00 
      11.00/14.00 
      11.00/14.00 
   lesn2 views
 quiz2  
      20.00/35.00 
22.00/35.00 
   lesn3 
     1 views
 quiz3 
     20.00/35.00 
   lesn4 
     0
 quiz4  
     0
   lesn5   
     0

Output Sample:
Alexandir Magnitsiy 4355
 quiz1 
     9.00/14.00 
      8.00/14.00 
      5.00/14.00 
      11.00/14.00 
      6.00/14.00 
      11.00/14.00 
      11.00/14.00
Answer:
Hint: You need to Download and install "Replace Pioneer" on windows platform to finish following steps.
The solution is extract specified pattern with regular expression.
1. open "Tools->Batch Runner" window
2. drag multiple text files from windows file browser to batch runner window
3. click "fast replace" button
4. click "add" to add new rule
* set "search" to:

* set "replace" to:

* click ok
5. make sure "reg exp" and "cross line" and "extract" flags are checked
6. click "start", done.

Screenshot 1:  Fast_Replace_Window


Similar Examples:
How to sort all lines of text by specified keyword? (67%)
How to shuffle all lines of text in specified range? (64%)
How to extract all lines with specified date range from text file? (64%)
How to find out all lines that appeared specified number of times? (64%)
How to count the number of consecutive lines with specified pattern? (63%)
How to replace all duplicate lines with some text? (63%)
How to list out all the lines which has having specified keyword.  (63%)
How to count the number of lines under each specified pattern? (62%)

Check Demo of Text file parser
Keywords:
avi  200  cross line  every  regular expression  very  expression  z s  rule  specified  batch file to extract text from file and replace with new text  regular and extract from text file  can make multiple search and replace  extract line from text file windows  extract from line to line text file windows  windows text file parser batch  windows extract text from multiple files  batch file to replace line text pattern from file