使用命令提示符/批处理逐行读取文本文件

发布于 2024-09-03 05:51:59 字数 453 浏览 1 评论 0原文

首先我非常感谢这个网站的所有者。在读者提供的解决方案的帮助下,我学习并实现了各种技术。

我知道我问的问题在这个论坛上已经发布过很多次了。我已经厌倦了所有可用的解决方案,但没有运气 我可能会尝试读取一个 dat 文件,该文件基本上是一个包含超过 22000 个字符的 msg/feed 文件。每条线的长度可能相同,也可能不同。我的要求是将文件转换为固定行长度字符文件。我有一个使用 vb 脚本运行良好的逻辑,但是它相当慢。 我已经检查过 For f/ 但没有运气。我唯一的分隔符是 EOT,我可以在文本板中看到它,但在记事本中看不到。 我尝试过 \n, token=。 请帮助我解决问题。 问候, 拉吉夫 [电子邮件受保护]

First of all I am very thankful to the owner of this website. I have learned and implement various technologies with the help of solutions provided by the readers.

I know the question I asked is posted many time in this forum. And I have tired all of the solutions available, but no luck
I may case I am trying to read a dat file which is basically a msg/feed file having more than 22000 Characters. Every line may or may not be of same length. My requirement is to convert the file to fixed line length character file. I have a logic that work well using vb script, however its pretty slow.
I have checked with For f/ but no luck. The only delimiter I have is EOT, which i can see in Textpad but not in notepad.
I have tried with \n, token=
.
Please help me in resolving the issue.
Regards,
Rajiv
[email protected]

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

郁金香雨 2024-09-10 05:51:59

如果 VBScript 太慢,那么批处理文件会更慢。 cmd 擅长的是运行程序;作为一个编程环境——没那么重要。字符串操作当然不是它的强项(我还没有知道是否可以真正操作任意字符串)。

话虽这么说,看看你的算法,分析它,找出是什么让它变慢。用另一种语言重新实现它可能不会让它变得更快。

If VBScript was too slow, then a batch file will be even slower. What cmd is good at is running programs; as a programming environment – not so much. And string manipulation is certainly not its strong point (I have yet to learn whether you can actually manipulate arbitrary strings).

That being said, look at your algorithm, profile it, find out what makes it slow. Chances are that re-implementing it in another language won't make it much faster.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文