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 9006371
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T01:23:38+00:00 2026-06-16T01:23:38+00:00

i receives this table from my process output into List<string> : List<string> list =

  • 0

i receives this table from my process output into List<string>:

enter image description here

List<string> list = new List<string>();
StreamReader reader = tsharkProcess.StandardOutput;

            while (!reader.EndOfStream)
            {
                string read = reader.ReadLine();
                list.Add(read);
            }

what would be the best way to parse this table to show only the ip address, the value and the parentage ?

  • 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-06-16T01:23:39+00:00Added an answer on June 16, 2026 at 1:23 am

    This will read the ipAddress, value and percentage on the fly if the rows are tab-delimited

    using(StreamReader reader = tsharkProcess.StandardOutput)
    {
       while (!reader.EndOfStream)
       {
           string[] values = reader.ReadLine().Split('\t');
           if (values.Length == 4)
           {
               string ipAddress = values[0];
               string value = values[1];
               string percentage = values[3];
               ...
           }
       }
    }
    

    If not then it could be done using RegEx.

    using(StreamReader reader = tsharkProcess.StandardOutput)
    {
       while (!reader.EndOfStream)
       {
           string row = reader.ReadLine();
           string[] values = Regex.Split(row, @"\s+", RegexOptions.None);
           if (values.Length == 4)
           {
               string ipAddress = values[0];
               string value = values[1];
               string percentage = values[3];
               ...
           }
       }
    }
    

    And the hard core RegEx solution.

    public class MyClass
    {
        // Lots of code....
    
        private static Regex regexRowExtract = new Regex(@"^\s*(?<ip>\d+\.\d+\.\d+\.\d+)\s*(?<value>\d+)\s+(?<rate>\d+\.?\d*)\s+(?<percentage>\d+\.?\d*)%\s*$", RegexOptions.Compiled);
    
        public void ReadSharkData()
        {
            using(StreamReader reader = tsharkProcess.StandardOutput)
            {
                while (!reader.EndOfStream)
                {
                    string row = reader.ReadLine();
                    Match match = regexRowExtract.Match(row);
                    if (match.Success)
                    {
                        string ipAddress = match.Groups["ip"].Value;
                        string value = match.Groups["value"].Value;
                        string percentage = match.Groups["percentage"].Value;
    
                        // Processing the extracted data ...
                    }
                }
            }
        }
    }
    

    For the Regex solution you should use:

    using System.Text.RegularExpressions;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

My company receives data from an external company via Excel. We export this into
Any comments/improvements on this process? User Table: id, username, password, salt Storing a New
the process is: a list of received messages shown in a table with a
Using SQL Server 2000. I have a table that receives a dump from a
This is the standard scenario: User registers on the site User receives an account
Flash receives the XML, but the values are wrong. How do I fix this?
I received this reply on the Live555-mailing list: FEC is not needed for UDP.
I want to raise an event from a .NET class, and receive this event
I have an application that receives most of its data from a third party.
I have a VARCHAR(4) column that receives data from an input that may be

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.