Edit a .gziped log text file in C#
I receive logs which are .gz (zipped) and contain text files.
One field in开发者_高级运维 the logs needs to be edited, present on every row, to contain some other data then what is currently present in the logs.
My thinking so far is to:
- Unzip file
- Read it
- Edit it
- Write it
- Rezip it
But I guess there is a better way to do this, is there any on-the-fly reading/editing from .gz log files available in C#?
Thanks!
Unless you want to work at the bit-level, the method you suggest is the correct approach.
incase you are unfamiliar with the .Net libraries for this, here is a code project article.
http://www.codeproject.com/KB/files/GZipStream.aspx
精彩评论