I
I
Ivan2017-03-03 14:15:26
Text Processing Automation
Ivan, 2017-03-03 14:15:26

How to find text in a file?

There is a file in it more than 7,000 lines
How to perform a search in the list
That is, from the beginning it searches one phrase after the machine automatically follows the next, and so all 64 phrases, if it finds something, write it to a separate file

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Artem, 2017-03-03
@devspec

A very complex and philosophical question.
First of all, you need to understand what programming language you are going to use to do the simplest line-by-line reading of a file and search by line occurrence.
In c#, for example, you can do something like this:

using (StreamReader streamReader = new StreamReader(this.MyPath))
{
     while (streamReader.Peek() > 0)
     {
          string line = streamReader.ReadLine();

          if (line.Contains(Resources.Constants.SpecificString)
          {
               // Do some action with the string.
          }
     }
}

The tag "Search technologies" is inappropriate here as never before.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question