You don't need to be an 'investor' to invest in Singletrack: 6 days left: 95% of target - Find out more
I have a largish text file (~700Mb) that i need to open and extract blocks of data from. Currently use Notepad++ which won't open it, so I need either:
- A (free!) large text file editor (I will happily accept it being a bit slow and clunky as I should have to use it only infrequently)
- A (Er, again, free!!) text file splitter. Again, doesn't have to be clever - simply splitting it in half would be fine, I can manipulate the data I need easily enough from there.
Anyone suggest anything? Ta in advance....
Learn ruby or perl, that kind of thing is easypeasy. Or if you've got access to a unix box, head -<number of lines> > cut_file.txt would do it, too.
Learn ruby or perl, that kind of thing is easypeasy
Probably true - lets assume I want to do this today, and conceivably may never get myself into this mess again 😉
Or if you've got access to a unix box
Hmmm..... we will have a Unix machine landing in about a week, which is about a week too late.
Any other suggestions?
textpad? Not sure if can handle that sort of size, but its free. Works ok with our CDR files.
Put it in a database? Have you got MS Access?
Pretty sure not based on a bit of googling. I have tried LFT Viewer, which will handle the size no probs, but is only a VIEWER and I will need to copy multiple large blocks of data out of it once opened.textpad? Not sure if can handle that sort of size, but its free.
Rich - not a bad shout that - don't have Access as part of our Office install though. Grr....
1. Download "UnxUpdates.zip" from http://unxutils.sourceforge.net/
2. Expand the zip somewhere
3. Open cmd.exe
4. c:\somewhere\split.exe my_really_big_file.log
This will create n 1000 line files in the same directory - use the -l option to change the file size.
4. c:\somewhere\split.exe -l 10000 my_really_big_file.log
Edit: 100% free.
Edit2: Windows.
Lemonysam/mogrim - many thanks. Looks like both those solutions will do the same thing/are ideal. Thanks again.
Mogrim's suggestion looks good. You could also try [url= http://www.ultraedit.com/downloads/ultraedit_download.html ]Ultraedit's free trial[/url] (normally costs $60) if it's just for today.
1. Install perl.
2. Put the stuff below ---- in a text file textfilesplitter.pl.
3. Run textfilesplitter.pl and follow instructions.
-----------------------
# use warnings;
################################################################################
# #
# VARIABLES #
# #
################################################################################
# name of the input file - set by cmd line argument or via user prompt
$inputfile = $ARGV[0];
# no lines to split file on - set by cmd line argument or via user prompt
$nolines = $ARGV[1];
# used for incrementing the name of the ouptut file
$fileext = 1;
################################################################################
# #
# MAIN #
# #
################################################################################
if ( $ARGV[0] eq "" || $ARGV[1] eq "" ) {
print "This program splits a text file on a set number of lines\nPlease enter the name of the file:\n\n";
chomp ( $inputfile = <STDIN> );
print "\n\nPlease enter the number of lines to split on:\n\n";
chomp ( $nolines = <STDIN> );
}
open ( INPUT , "<$inputfile" ) || die "cannot open input file: $inputfile : $!\n\n";
open ( OUTPUT , ">$inputfile.$fileext" ) || die "cannot open output file : $inputfile.$fileext : $!\n\n";
while ( <INPUT> ) {
print OUTPUT;
$count++;
if ($count == $nolines ) {
close ( OUTPUT );
$totalcount = $totalcount + $count;
print "Total lines processed: $totalcount\n\n";
$fileext++;
open ( OUTPUT , ">$inputfile.$fileext" ) || die "cannot open output file : $inputfile.$fileext : $!\n\n";
print "writing data to $inputfile.$fileext\n\n";
undef $count;
}
}
close ( OUTPUT );
close ( INPUT );
$totalcount = $totalcount + $count;
print "Total lines processed: $totalcount\n\n";
Tried Emacs? There is a Windows port.
All done now - gsplit did it fine.
I did see the Windows port for Emacs..... but (as with the Perl solution) I don't really want to spend more than 5 mins on this as the data manipulation is where the effort is at..... and there is - inevitably - a deadline on it.
Thanks again all.
Other editors may exist - but this is infinitely better named: [url= http://www.brothersoft.com/chainsaw-8796.html ]CHAINSAW!!!!!![/url]
My go-to for straightforward viewing (usually a big logfile I need to se the end of) is [url= http://www.baremetalsoft.com/baretail/ ]Baretail[/url]. Blazing fast as it only shows you the bit of the file you're actually looking at.
get textpad, should do it.
And if you buy a licence you also get wildedit which is a pretty powerful editor