I'm looking for a tool to find a line containing a searced text inside a file that has a size of 4 GB
|
|
When you use *nix, you could also use |
|||
|
|
|
If you have powershell installed you could use
It probably won't be fast, but won't choke like find or findstr probably will. |
|||
|
|
|
Not free, but if this is a text file, then BareTailPro might do the job. I have used it to search for text in logfiles which were too large to fit in memory. One advantage is that it does not just show the text, but allows you to jump into the text file, so you can see the lines before and after the hits. |
|||
|
|
|
If you do it often enough, and the file is broken into logical lines, you could load it into Splunk and search from there. It'll do indexing for you to be quick(er). |
|||
|
|
|
I'd use grep on *nix, and I'd use a higher end text editor (e.g Notepad++) on Windows. |
|||
|
|
|
It depends on the application, the response time needed, and what you're willing to do to meet those goals. Recently, I was working with a 10+ GB, 50+ million line text file and had a need to search for specific strings in each line. Standard Unix tool "grep" did the trick, but took an unacceptably long time (multiple minutes). I imported the text into a postgreslq DB (it was a CSV file, easily imported), and once indexed on the key I needed to search on, it took under 1 second to find my record. Granted, my workstation is single-core, with only 4GB RAM, a 4-year-old 2GHz CPU, and a top-heavy filesystem (ZFS) using 5+ year-old consumer PATA drives. Your mileage will certainly vary. Still, the time difference between the two methods is staggering. If your data is free-form text, you might still consider importing into a DB which supports full-text search and indexes appropriately to support such searches. Even if you have the RAM to have the entire file cached and a fast machine, doing a linear search of files this size will be time inefficient, depending (once again) on the application. |
|||
|
|
|
At the Windows CMD prompt, there are two commands Type |
|||
|
|