log文件的读并写入.text文件

本文记录了一个编程任务,涉及读取.log文件,提取特定字段,并将内容写入.txt文件的过程。主要关注字符串操作、换行符处理、路径访问及异常处理。
摘要由CSDN通过智能技术生成

今天要写一个功能的代码,读.log文件并去相关字段写入.txt 。在此做个笔记!

        public const string ReadFilePath = "C:\\Documents and Settings\\admin\\桌面access_20111207.log";
        public const string WriteFilePath = "C:\\Documents and Settings\\admin\\桌面\\log.txt";
        public static ArrayList al;
        static void Main(string[] args)
        {
            ReadPath("C:\\Documents and Settings\\admin\\桌面");
            //单个文件
            //if (File.Exists(ReadFilePath))
            //{
            //    ReadLog(ReadFilePath);
            //}
            //else
            //{
            //    Console.WriteLine("读入的文件不存在!");
            //    Console.ReadLine();
            //}
        }

        public static void ReadPath(string path)
        {
            if (System.IO.Directory.Exists(path))
            {
                DirectoryInfo d
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值