Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3350022
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T01:44:11+00:00 2026-05-18T01:44:11+00:00

I have an .EDF (text) file. The file’s contents are as follows: ConfigFile.Sample, Software

  • 0

I have an .EDF (text) file. The file’s contents are as follows:

    ConfigFile.Sample, Software v0.32, CP Version 0.32
    [123_Float][2]
    [127_Number][0]
    [039_Code][70]

I wnat to read these items and parse them like this:

    123_Float - 2
    127_Number - 0
    039_Code - 70

How can I do this using C#?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T01:44:12+00:00Added an answer on May 18, 2026 at 1:44 am

    Well, you might start with the File.ReadAllLines() method. Then, iterate through the lines in that file, checking to see if they match a pattern. If they do, extract the necessary text and do whatever you want with it.

    Here’s an example that assumes you want lines in the format [(field 1)][(field 2)]:

    // Or wherever your file is located
    string path = @"C:\MyFile.edf";
    
    // Pattern to check each line
    Regex pattern = new Regex(@"\[([^\]]*?)\]");
    
    // Read in lines
    string[] lines = File.ReadAllLines(path);
    
    // Iterate through lines
    foreach (string line in lines)
    {
       // Check if line matches your format here
       var matches = pattern.Matches(line);
    
       if (matches.Count == 2)
       {
          string value1 = matches[0].Groups[1].Value;
          string value2 = matches[1].Groups[1].Value;
    
          Console.WriteLine(string.Format("{0} - {1}", value1, value2));
       }
    }
    

    This outputs them to the console window, but you could obviously do whatever you want with value1 and value2 (write them to another file, store them in a data structure, etc).

    Also, please note that regular expressions are not my strong point — there’s probably a much more elegant way to check if a line matches your pattern 🙂

    If you want more info, check out MSDN’s article on reading data from a text file as a starting point.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have below string output Version: 9.1.2(Build:40) Syntax version:4.00.10 Components: Engine Processors Configuration file:
Have been following Rails Tutorial by Michael Hart rails version 3.0 on mac OS
Have added the following code to my SQL query: (Note cut down version) DECLARE
I have some data on a single line like below abc edf xyz rfg
Have a look at this code sample or go to the jsfiddle function printRelation(a,
Have a text box which get data for price. If someone enter something like
Have an app that can use tts to read text messages. It can also
Have their been any studies related to the importance of how good a software
I have the following network diagram: set.seed(1410) df<-data.frame( site.x=c(rep(a,4),rep(b,4),rep(c,4),rep(d,4)), site.y=c(rep(c(e,f,g,h),4)), bond.strength=sample(1:100,16, replace=TRUE)) library(igraph) df<-graph.data.frame(df)
have written this little class, which generates a UUID every time an object of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.