我指的是100+ MB大小;这样的文本文件可以挑战编辑器的极限。
我需要查看一个大的XML文件,但如果编辑器有bug就不能。
有什么建议吗?
我指的是100+ MB大小;这样的文本文件可以挑战编辑器的极限。
我需要查看一个大的XML文件,但如果编辑器有bug就不能。
有什么建议吗?
免费只读查看器:
Large Text File Viewer (Windows) – Fully customizable theming (colors, fonts, word wrap, tab size). Supports horizontal and vertical split view. Also support file following and regex search. Very fast, simple, and has small executable size. klogg (Windows, macOS, Linux) – A maintained fork of glogg. Its main feature is regular expression search. It supports monitoring file changes (like tail), bookmarks, highlighting patterns using different colors, and has serious optimizations built in. But from a UI standpoint, it's rather minimal. LogExpert (Windows) – "A GUI replacement for tail." It's really a log file analyzer, not a large file viewer, and in one test it required 10 seconds and 700 MB of RAM to load a 250 MB file. But its killer features are the columnizer (parse logs that are in CSV, JSONL, etc. and display in a spreadsheet format) and the highlighter (show lines with certain words in certain colors). Also supports file following, tabs, multifiles, bookmarks, search, plugins, and external tools. Lister (Windows) – Very small and minimalist. It's one executable, barely 500 KB, but it still supports searching (with regexes), printing, a hex editor mode, and settings.
自由编辑:
Your regular editor or IDE. Modern editors can handle surprisingly large files. In particular, Vim (Windows, macOS, Linux), Emacs (Windows, macOS, Linux), Notepad++ (Windows), Sublime Text (Windows, macOS, Linux), and VS Code (Windows, macOS, Linux) support large (~4 GB) files, assuming you have the RAM. Large File Editor (Windows) – Opens and edits TB+ files, supports Unicode, uses little memory, has XML-specific features, and includes a binary mode. GigaEdit (Windows) – Supports searching, character statistics, and font customization. But it's buggy – with large files, it only allows overwriting characters, not inserting them; it doesn't respect LF as a line terminator, only CRLF; and it's slow.
内置程序(不需要安装):
less (macOS, Linux) -传统的Unix命令行寻呼机工具。允许您查看几乎任何大小的文本文件。也可以安装在Windows上。 记事本(Windows) -适合处理大文件,特别是关闭自动换行。 MORE (Windows) -这是指Windows MORE,而不是Unix MORE。一个控制台程序,允许您查看一个文件,一次一个屏幕。
网络观众:
readfileonline.com -另一个HTML5大文件查看器。支持搜索。
支付编辑/观众:
010 Editor (Windows, macOS, Linux) – Opens giant (as large as 50 GB) files. SlickEdit (Windows, macOS, Linux) – Opens large files. UltraEdit (Windows, macOS, Linux) – Opens files of more than 6 GB, but the configuration must be changed for this to be practical: Menu » Advanced » Configuration » File Handling » Temporary Files » Open file without temp file... EmEditor (Windows) – Handles very large text files nicely (officially up to 248 GB, but as much as 900 GB according to one report). BssEditor (Windows) – Handles large files and very long lines. Don’t require an installation. Free for non commercial use. loxx (Windows) – Supports file following, highlighting, line numbers, huge files, regex, multiple files and views, and much more. The free version can not: process regex, filter files, synchronize timestamps, and save changed files.
技巧和窍门
less
为什么使用编辑器只查看(大)文件?
在*nix或Cygwin下,只需少使用。(有一个著名的说法——“少即是多,多或少”——因为“少”取代了早期的Unix命令“多”,增加了你可以向上滚动的功能。)在less下搜索和导航非常类似于Vim,但是没有交换文件,使用的RAM很少。
GNU有一个Win32的移植版本。请看上面答案的“少”部分。
Perl
Perl适合编写快速脚本,它的..(范围触发器)操作符提供了一个很好的选择机制,以限制你必须涉猎的混乱。
例如:
$ perl -n -e 'print if ( 1000000 .. 2000000)' humongo.txt | less
这将提取从第100万行到第200万行的所有内容,并允许您手动筛选输出。
另一个例子:
$ perl -n -e 'print if ( /regex one/ .. /regex two/)' humongo.txt | less
当“正则表达式1”找到一些东西时开始打印,当“正则表达式2”找到一个有趣的块的结尾时停止打印。它可能会找到多个块。筛选输出…
日志解析器
这是您可以使用的另一个有用的工具。引用维基百科的文章:
logparser is a flexible command line utility that was initially written by Gabriele Giuseppini, a Microsoft employee, to automate tests for IIS logging. It was intended for use with the Windows operating system, and was included with the IIS 6.0 Resource Kit Tools. The default behavior of logparser works like a "data processing pipeline", by taking an SQL expression on the command line, and outputting the lines containing matches for the SQL expression. Microsoft describes Logparser as a powerful, versatile tool that provides universal query access to text-based data such as log files, XML files and CSV files, as well as key data sources on the Windows operating system such as the Event Log, the Registry, the file system, and Active Directory. The results of the input query can be custom-formatted in text based output, or they can be persisted to more specialty targets like SQL, SYSLOG, or a chart.
使用示例:
C:\>logparser.exe -i:textline -o:tsv "select Index, Text from 'c:\path\to\file.log' where line > 1000 and line < 2000"
C:\>logparser.exe -i:textline -o:tsv "select Index, Text from 'c:\path\to\file.log' where line like '%pattern%'"
大小的相对性
100mb并不太大。3gb有点大了。我曾经在一家打印和邮件公司工作,该公司生产了大约2%的美国第一类邮件。在我担任技术主管的一个系统中,大约有15%以上的邮件是由它处理的。我们有一些大文件需要到处调试。
和更多的……
请在这里添加更多的工具和信息。这个答案是社区维基的一个原因!在处理大量数据方面,我们都需要更多的建议。