; this is sample script
; 2002/02/23 by Gaku - modoki grep

if (3 > arg) {
	print("usage : ", arg[0], " <regex> <filename>\n");
	return;
}

file = open(arg[2]);
if (null == file) {
	print("cannot open file\n");
	return;
}

count = 1;

loop {
	buf = gets(file);
	if (null == buf) {
		break;
	}

	if (1 == match(arg[1], buf)) {
		print(count, "\t", buf);
	}

	count = count + 1;
}

close(file);
