summaryrefslogtreecommitdiff
path: root/db/db_printlog/range.awk
blob: 045c7fb20707d6b033154d443f13e95fc5a92f9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# $Id: range.awk,v 12.0 2004/11/17 03:43:25 bostic Exp $
#
# Print out a range of the log

/^\[/{
	l = length($1) - 1;
	i = index($1, "]");
	file = substr($1, 2, i - 2);
	file += 0;
	start = i + 2;
	offset = substr($1, start, l - start + 1);
	i = index(offset, "]");
	offset = substr($1, start, i - 1);
	offset += 0;

	if ((file == START_FILE && offset >= START_OFFSET || file > START_FILE)\
	    && (file < END_FILE || (file == END_FILE && offset < END_OFFSET)))
		printme = 1
	else if (file == END_FILE && offset > END_OFFSET || file > END_FILE)
		exit
	else
		printme = 0
}
{
	if (printme == 1)
		print $0
}