I've got a bit of an odd one here. After attempting, several times, to utilize the good tool csplit on a 4.6 Gig file, and having it seg fault on me, I resorted to rolling my own short, sweet perl script.
Essentially I've discovered a kernel log file that hasn't been rotated since September of 2005, and I'd like to keep only the data for the year 2007; I'd done a grep with line numbers and discovered that the first line for 2007 was located at line 19,035,437.
And when run (with a different skip value) on a different 2.5 Gig log file, it worked beautifully, but when run on the 4.6 Gig file, I'm getting this:#!/usr/bin/perl $skip = 19035437; while(<>) { if(! ($. % 1000000)) { printf STDERR "processed line $.\n" } last if $. == $skip; } while(<>) { printf STDOUT $_; }
Line 13 corresponds to the "printf STDOUT $_;" line.processed line 1000000 processed line 2000000 processed line 3000000 processed line 4000000 processed line 5000000 processed line 6000000 processed line 7000000 processed line 8000000 processed line 9000000 processed line 10000000 processed line 11000000 processed line 12000000 processed line 13000000 processed line 14000000 processed line 15000000 processed line 16000000 processed line 17000000 processed line 18000000 processed line 19000000 Modification of a read-only value attempted at mysplit.pl line 13, <> +line 20804003.
Thinking this might be an overflow of some sort, I checked the binary representation of 20804003, and it happens to be: 1001111010111000110100011, so it's certainly not what I would think would be near an overflow.
Does anyone have any ideas of what might be happening here?
This is perl 5.8.5 running on dual intel 32 bit xeon 2.4 gig chips.
-Scott
In reply to line number ($.) problem ? by 5mi11er
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |