Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I have a text file:

=====================================================================================================
        --NUO---    --IKI- ATSTUMAS                     MAKS.   NUKRYPIMAS    KATEGORIJA              
KELIAS    KM M       KM M      M  PARAMETRAS            REIKSME VIETA      ESAMA   GALIMA  LAIPSNIS   
=====================================================================================================
I          34,452    34,449     3 PERKRYPA                17    34,451     V       V-15    4  
                                                                     [55,47868125|21,43902188|   38]
I          34,396    34,393     3 PERKRYPA                19    34,395     V       V-15    4  
                                                                     [55,47913606|21,43864715|   37]
I          34,269    34,267     2 PERKRYPA               -14    34,268     V       VI      4  
                                                                     [55,48019067|21,43788667|   37]
I                    34,0         KM: 34 <1000>                      [55.48244916|21.43642915|   37]
I          33,678    33,675     3 PLOTIS1                -12    33,676     V       STOP    4  
                                                                     [55,48517892|21,43466534|   37]
I          33,645    33,642     3 PERKRYPA               -19    33,643     V       V-15    4  
                                                                     [55,48545685|21,43448551|   37]

I want to filter all the PERKRYPA lines and therefore leave only the coordinates (e.g [55,47868125|21,43902188) in the document, in order to copy all of them to another window.

share|improve this question

2 Answers 2

So i always advice Sublime Text 2 cause it have nice text editing features. Anyway i describe some steps what i do to get this

use find text with next regexp

I .+PERKRYPA.+\n

or something like that, next press find all and you select all lines wich match your regexp pic1

this text editor have multiselection feature, delete end line delimiter and youl have all data you need on one line. enter image description here


Try search again and you'll have all data you need. Copy selected data and paste it to new tab. Enjoy;).

enter image description here

share|improve this answer
    
is this bad soluion? –  Ishikawa Yoshi Sep 27 '12 at 14:58
    
It's not Notepad++. –  sapht Sep 27 '12 at 17:50
    
i'm not advertise sublimetext2, but i think sometimes it's more easy to use, what wrong if i suggest another decision? i think it have place to be. –  Ishikawa Yoshi Sep 28 '12 at 8:37

You can do it with NotePad++ by doing a search and replace.

  1. Press Ctrl+H to open the Replace dialog.

  2. For Find what, enter:

    ^.*?(PERKRYPA.*?\r\n\s*(\[.+?\]))|.*\r\n
    
  3. For Replace with, enter:

    \2
    
  4. Set Search Mode to be Regular expression.

  5. Hit the Replace All button.

enter image description here

share|improve this answer
    
There full text file [link]sharetext.org/3X1j With notepad don't work for me. But i want learn to use filter with notepad :) –  Benas Sep 28 '12 at 5:53
    
What happens if you run it? You uploaded a .htm file, is that the original format, ie is it using CR + LF (Windows/DOS line feeds). –  snowdude Sep 28 '12 at 8:34

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.