troubleshooting Question

How to process a txt file for parsing with a function in C#

Avatar of Skale
Skale asked on
C#
11 Comments2 Solutions96 ViewsLast Modified:
Hello,

I've a txt file like below and i'd like to get some informations from it with a function but need a expert help for parsing.

  139 142    :No. nodes, No. modes:
 part                                            
      new modal                                 =                                                                                 
           refmod                                
                mass                            = 2.000D+03
                nelastq                         = 142
                ielastq (   1)                  = Eigen Mode    7 :        3.895 Hz
                ielastq (   2)                  = Eigen Mode    8 :        8.914 Hz
                ielastq (   3)                  = Eigen Mode    9 :       10.455 Hz
                ielastq (   4)                  = Eigen Mode   10 :       10.633 Hz
                ielastq (   5)                  = Eigen Mode   11 :       14.134 Hz
                ielastq (   6)                  = Eigen Mode   12 :       14.230 Hz
                ielastq (   7)                  = Eigen Mode   13 :       14.839 Hz
                ielastq (   8)                  = Eigen Mode   14 :       15.543 Hz
                ielastq (   9)                  = Eigen Mode   15 :       16.810 Hz
                ielastq (  10)                  = Eigen Mode   16 :       16.921 Hz
                ielastq (  11)                  = Eigen Mode   17 :       17.858 Hz
                ielastq (  12)                  = Eigen Mode   18 :       18.822 Hz
                ielastq (  13)                  = Eigen Mode   19 :       19.006 Hz
                ielastq (  14)                  = Eigen Mode   20 :       19.335 Hz
                ielastq (  15)                  = Eigen Mode   21 :       19.430 Hz
                ielastq (  16)                  = IRM           1 :       59.876 Hz
                ielastq (  17)                  = IRM           2 :       60.495 Hz
                ielastq (  18)                  = IRM           3 :       61.735 Hz
                ielastq (  19)                  = IRM           4 :       64.041 Hz
                ielastq (  20)                  = IRM           5 :       67.065 Hz
                ielastq (  21)                  = IRM           6 :       67.663 Hz
                ielastq (  22)                  = IRM           7 :       69.528 Hz
           end refmod   
	   
			Some Text Data
			.
			.
			.     
           

I'd like to get informations from  ielastq (   *id*) rows.

If there's a function like

public static string[] GetIElastiq(int id)
{
// some code here
}

if i wrote id 10 that function i'd like to get result as [ {Eigen Mode}, {16}, {16.921} ]

It'll found the row:          
   ielastq (  10)                  = Eigen Mode   16 :       16.921 Hz

and parse for me.

The values always between "refmod" and "end refmod" so Textreader only can focus this region.

Any help would be very great!!

Thank you.
ASKER CERTIFIED SOLUTION
ste5an
Senior Developer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 2 Answers and 11 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 11 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros