在 47GB 大文件中查找和替换文本 [英] Find and replace text in a 47GB large file
本文介绍了在 47GB 大文件中查找和替换文本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我必须在一个相当大的文件上做一些查找和替换任务,大约 47 GB 大小.
I have to do some find and replace tasks on a rather big file , about 47 GB in size .
有人知道怎么做吗?我尝试使用 TextCrawler、EditpadLite 等服务,但没有任何东西支持这么大的文件.
Does anybody know how to do this ? I tried using services like TextCrawler , EditpadLite and more but nothing supports this large a file .
我假设这可以通过命令行来完成.
I'm assuming this can be done via the commandline .
你知道如何做到这一点吗?
Do you have an idea how this can be accomplished ?
推荐答案
Sed (用于过滤和转换文本的流编辑器)是您的朋友.
Sed (stream editor for filtering and transforming text) is your friend.
sed -i 's/old text/new text/g' file
Sed 一次性完成文本转换.
Sed performs text transformations in a single pass.
这篇关于在 47GB 大文件中查找和替换文本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文