从多个文本文件中提取特定字符串 [英] Extract a particular string from multiple text files

查看:103
本文介绍了从多个文本文件中提取特定字符串的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对文本文件格式有一些独特的字符串提取问题。在使用C#的Windows 7环境中,我想在每个文本文件中提取一个字符串,只要它对于给定目录中的每个文件以680000开头。



理想情况下,对于以68000开头的任何行,将读取每个文件。如果该行以68000开头,则将其保存到output.txt文件中。一旦读取了以68000开头的所有行并将其提取到output.txt中,就会分析下一个文件。直到读取给定目录中的所有文件并提取字符串。



谢谢。

I have a bit of a unique string extraction problem for a text file format. On a Windows 7 environment using C#, I want to extract a string in each text file as long as it begins with "680000" for each file in a given directory.

Ideally, each file would be read for any line that begins with 68000. If the line begins with 68000, then it is saved to an output.txt file. Once all of the lines starting with 68000 are read and extracted into the output.txt, then the next file is analyzed. Until all the files in the given directory are read and the strings extracted.

Thanks.

推荐答案

看看类似(已解决)的问题:从文本文件中提取行 [ ^ ]
Have a look at similar (solved) question: Extract line from a text file[^]


这篇关于从多个文本文件中提取特定字符串的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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