我如何在压缩文本文件中查找文本模式? [英] How can I grep for a text pattern in a zipped text file?

查看:128
本文介绍了我如何在压缩文本文件中查找文本模式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我们的每日Feed文件平均大小为2 GB。这些文件在每月月底被归档到一个zip文件并存储在网络共享中。有时我需要搜索这些文件中的某些记录。我通过将远程桌面连接到共享服务器,将文件解压缩到临时文件夹,运行grep(或PowerShell)搜索,然后删除临时文件夹来完成此操作。现在,由于我们的服务器磁盘空间不足,因此不再推荐将它们全部解压到临时文件夹。什么是对这些压缩文件执行正则表达式搜索的有效方式,而对磁盘或网络资源的影响最小?

Linux上的href =http://linux.about.com/library/cmd/blcmdl1_zgrep.htm =noreferrer> zgrep 。如果您使用的是Windows,则可以下载 GnuWin ,其中包含一个zgrep的Windows端口。


Our daily feed file averages 2 GB in size. These files get archived to a single zip file at the end of each month and stored in a network share. From time to time, I have a need to search for certain records in those files. I do this by connecting by remote desktop to the shared server, unzip the files to a temp folder, run grep (or PowerShell) search, and then delete the temp folder. Now, because our server is running low in disk space, it is no longer recommeded to unzip them all to a temp folder. What is an efficient way to do a regex search on those zipped files with minimum impact on disk or network resources?

解决方案

zgrep on Linux. If you're on Windows, you can download GnuWin which contains a Windows port of zgrep.

这篇关于我如何在压缩文本文件中查找文本模式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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