How to filter 100 pages text file by using specific keyword?


There is text file in which there is 100 pages out of 100 pages there are only few pages containing specific unique keyword.I want only those pages ex.(There are 100 pages in that few pages contain
(ex.Note keyword) I want only that pages containing Note keyword and it is structured Text file.

Need Help!!


In text file all the text has been considered as a single Pageā€¦ Do you have any page break in that file.

Where the note keyword will be available at the beginning of the page or at end of the page

yes there is page break

yes there is page break k


Could you please mention the page break character or keyword here

keyword is city name like mumbai

keyword is city name like mumbaii


Is the city name static one or will vary page to oage.?

If possible share a sample text file with 2-5 pages with temp data for better understanding and better help

Text.txt (6.5 KB)

Mumbai is page Break

and Note: is Keyword

check plz

Give a try on split the text into an array with a split functionality on Mumbai
May do some optimizations e.g. trim or RegEX for cleansing up the text
Iterate classical over the array and identify the pages by keyword e.g. with a contain
add relevant pages e.g. with add to collection to a list of strings

For last actions (Identication, filtering relevant pages) a LINQ statement can help as well

You need pages with Keyword means you need content of only those pages right?
I have written small process for you with your text file, split would help you to achieve it. (15.7 KB)