Sometimes it happen that: for mistakes, because you don’t rotate your logs or perhaps they growth up really quickly, that you need to analyse a large file (> 1GB) for searching a specific pattern of text. Probably you’ll go nowhere if you try to open them with vi
or worst with a graphical editor like Gedit or libreoffice, and if your resource are low you risk to use all the memory and put your linux box in hang.
But don’t worry, like many things in Unix/Linux, there is a specific tool that can help you in this operation: Rowscope
Rowscope is a graphical file viewer for large text files. It can read files larger than 1 GB.
Rowscope is written in Scala and uses SWT for the GUI.
The program it’s distributed from the official download page as a .jar package, so you just need to have java installed to run it.
The idea behind Rowscope is that a person cannot read the whole file when it is so large; a person can only read some parts of the file, possibly the ones that contain the information he is looking for.
For example when somebody reads the log file produced by an application, he will probably look for a specific error or for the lines produced in a specific period of the day.
What the user can do with Rowscope
- Localizes the part or parts of the file that he wants to read, using search strings or regular expressions.
- Then he can expand one of the rows he has found, which means that he makes Rowscope display the rows immediately before or after that row.
Going back to the log example, let’s say the user wants to find what caused an error in the application. Knowing that the application logs its errors, he searches for the word ERROR. Once that the user find the line with that string he can choose to expand further lines and analyse what’s happened just before that event.
GUI description
Rowscope it’s really easy to use, just choose your file, put the string you want to search and you are done.
The following picture (from the official site) describes each part of the GUI:
Popular Posts:
- None Found
Sorry, but you’re never gonna convince me that anything gui will ever compete with the combined power of vi, sed, awk, grep and cut
After 25 years of ‘nix support, I’ve never hit a wall those utilities can’t climb…
What about a simple ‘less -n’ on that big file ?
-n or –line-numbers
Suppresses line numbers. The default (to use line numbers) may
cause less to run more slowly in some cases, especially with a
very large input file. Suppressing line numbers with the -n
option will avoid this problem. Using line numbers means: the
line number will be displayed in the verbose prompt and in the =
command, and the v command will pass the current line number to
the editor (see also the discussion of LESSEDIT in PROMPTS
below).
i’m not sure that this is enough for opening a big file > 1 GB, never tried it.