如何在控制台中解析不同的电子日志日志文件 [英] How do I parse different electronic journal log file in console

查看:84
本文介绍了如何在控制台中解析不同的电子日志日志文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经尝试了很多次,但是我无法进行解析?能不能帮我解决这个问题。



我有什么试过:



 static void Main(string [] args)
{


foreach(File.ReadLines中的字符串行(Parsing.txt))
{
Console.WriteLine({0},line);

}
Console.Write(输入你的搜索文字:);
var text = Console.ReadLine();

}

解决方案

您需要检查文件的格式。也许你开始将它读入一个char数组,看看文件中是否有一些不可见的控制字符lile'\ r'。替换它们或过滤掉它们。



也许你没有打开文件,因为它找不到。最好是使用完整路径(或相对于应用程序)。



学习使用调试器。

I have tried many times but i was unable to do parsing?Could you please help me to come out from this problem.

What I have tried:

static void Main(string[] args)
       {


           foreach (string line in File.ReadLines("Parsing.txt"))
           {
               Console.WriteLine("{0}", line);

           }
           Console.Write("Input your search text: ");
           var text = Console.ReadLine();

       }

解决方案

You need to check the format of your file. Maybe you start reading it into a char array to see whether some invisible control characters lile '\r" are in the file. Replace them or filter them out.

Maybe you havent opened the file because it wasnt found. Best is to use a full path (or relative to the app).

Learn to use the debugger.


这篇关于如何在控制台中解析不同的电子日志日志文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆