Searching for data in a console app!

             using System;
    using System.IO;
    using System.Collections;
    namespace ReadFiles
        class Program
            static void Main(string[] args)
                StreamReader objstream = new StreamReader("c:\\\\documents and settings\\\\btallos\\\\desktop\\\\Company.txt");
                string sLine ="";
                ArrayList arrText = new ArrayList();
                    while (sLine != null)
                        sLine = objstream.ReadLine();
                        if (sLine != null)
                foreach (string sOutput in arrText)

I wrote a console app that displays information from a local file on my desktop and displays the content within the file. I was wondering how can I create a function that can search for keywords and only display the words, I want it to search for?

I’m trying to display this content in a database and search for the content I want it to display.

Can anyone help me out?
[SIZE=3]* ZIP Codes

  • Area Codes
  • City Name
  • State Name
  • Two digit State Code
  • City Type
  • City Alias Abbrev.
  • County Name
  • State FIPS
  • County FIPS
  • Time Zone
  • Daylight Savings Indicator
  • Number of Businesses
  • Q1 Payroll
  • Annual Payroll
  • Number of Employees
  • Employment Flag
  • County Growth Rate

I tried something like this - And it didn’t work. :frowning:

  var keywords = new string[] {"some", "keywords"};
  var foundKeywords = File.ReadAllLines("filename").
    SelectMany(line => keywords.Where(keyword => line.Contains(keyword))).



If I actually needed to use this, I’d just import the data into excel and use it’s fitering functions.

If I needed to build this, I’d use lucene as a local/embedded datastore and let it do the searching.

How would you import that data into excel?

var rx = new Regex(@"\\w+");
var text = File.ReadAllText("c:\\\\documents and settings\\\\btallos\\\\desktop\\\\Company.txt");
var targets = new HashSet<string> {"some", "keywords"};
var matches = rx.Matches(text).Cast<Match>().Select(x => x.Value).Where(targets.Contains);

I’d try file -> open and let the excel import wizard take a shot first . . .

Note: I’m presuming there is some sort of delimiter here. Can you post some sample data?