search and...

  • Nobody/Anonymous

    Hello, I'm trying to process a file and I'd like to know if there is a way to do any of the following.

    I have a file and there is a line that starts with a unique key word, however there are many MANY instances of this line.  I'd like only this line to show or be copied.  I know I can search and count the number of instances and that I can search and mark each line, but how can I search and keep only those lines or copy/move them to a new file?

    • Chris Severance

      Chris Severance - 2006-12-12

      TextFX Viz can do this for you. Copy ^KEYWORD to your clipboard, turn on TextFX Viz Settings | Viz Text Search Regex, then select TextFX Viz Hide Lines without (Clipboard) text.

      Tools to copy visible lines to the clipboard are provided.

    • Nobody/Anonymous

      I have exactly the same question. My file is a very large log file and I want to keep only those lines in which I'm interrested in. Something like an internal grep

      • Nobody/Anonymous

        Well I was in a pinch and since my lines started the same way I just dumped the file into a spreadsheet, then sorted the lines and grabbed the data I needed.

        This only worked because the line started that way, if they had started differently though I'd be out of luck.  If there is away to select and preform an action on all marked lines, I'd sure love to know how.

    • Nobody/Anonymous

      i Have the same problem. I search a huge log file and want to delete all lines without
      the searching word. Now i had to do it manually.

    • Nobody/Anonymous

      You could download grep for windows.  It's a wonderfully powerful little app, and I use it with Notepad++ all the time.

      It takes a minute to learn the command line options, but it is worth it.

    • DV

      DV - 2006-12-01

      Or you can use simple AWK script for awk95.exe by Brian Kernighan. For your example, an AWK script would be similar to this:

      /^key_word/ {
          print $0 > "outfile.txt"

      This example takes all text lines which start with  key_word  and put these text lines to a file "outfile.txt".


Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

No, thanks