I'm a web developer for NOVICA. I'm fascinated by languages, even though I only speak English and a little Spanish. I can count in Korean and have numerous language and linguistics books. I'm living within walking distance of CSUN where I share an apartment with my girlfriend and 2 cats. I'm happy. I write sporadically (I really need to finish that short story), with every intention of making a living at it at an undisclosed point in the future. I taught physics at Emperor's College Winter Term 2008. I love games and stories and music and computers and science and "and." I drink my coffee 100% black 80% of the time and 80% black 20% of the time. Also, there are other things. 7332 42
Previous Entry :: Next Entry

Read/Post Comments (0)
Share on Facebook





perl

I installed perl on my windows workstation so i could manipulate some email related files... It's been a while since I wrote any perl, but I was able to write a quick script to split some VERY large files into smaller files that another process could deal with easier:
open(INFILE,$ARGV[0]) or die "Can't open $ARGV[0]: $!";

($filename,$extention) = split(/\./,$ARGV[0]);

my $linecount = 0;

while(<INFILE>) {
	unless ($linecount % 10000) {
		my $filenumber = $linecount / 10000;
		close(OUTFILE);
		my $outfilename = $filename."_".$filenumber.".".$extention;
		open(OUTFILE,"<$outfilename") or die "can't open $outfilename: $!"; 
	}
	print OUTFILE $_;

	$linecount += 1;	
}

close(INFILE);
close(OUTFILE);
I'm sure someone could one line this or better it in many interesting ways, but it did what i needed it to do.


Read/Post Comments (0)

Previous Entry :: Next Entry

Back to Top

Powered by JournalScape © 2001-2010 JournalScape.com. All rights reserved.
All content rights reserved by the author.
custsupport@journalscape.com