Steven Schubiger <[EMAIL PROTECTED]> writes:
> linecut performed a bit more than 3-times faster than the script).
Here's an Awk script that ran twice as fast as the script you used,
which suggests that scripting is still pretty competitive with C here,
if you choose a faster implementation. I tested it using Mawk, on a
text file with 15,699,634 bytes and 514,573 lines.
#! /usr/bin/mawk
BEGIN {
sets[1, 1] = 1
sets[1, 2] = 2
sets[2, 1] = 20
sets[2, 2] = 24
sets[3, 1] = 50
sets[3, 2] = 100
sets[4, 1] = -30
sets[4, 2] = -1
}
{ line[NR] = $0 }
END {
for (i=1; i<=4; i++) {
start = sets[i, 1]
end = sets[i, 2]
if (start < 0) start = NR + start
if (end < 0) end = NR + end
for (current = start; current <= end; current++) print line[current]
}
}
_______________________________________________
Bug-coreutils mailing list
[email protected]
http://lists.gnu.org/mailman/listinfo/bug-coreutils