Hi.
I found the requirements unclear, and posting a few sample files and expected output would allow more on-point responses.
I assume you wish to search for matches in several files, but to omit the first few matches for each file -- that is, skip, say the first 11 matches for each file.
The utility cgrep can do this. Here is a script that reads 2 sample files containing mostly lines of the form "1.1, 1.2 .." for the first file, and "2.1, 2.2 ..." for the second file:
#!/usr/bin/env bash
# @(#) s1 Demonstrate cgrep skipping N matched lines.
# http://www.bell-labs.com/project/wwexptools/cgrep/
echo
set +o nounset
LC_ALL=C ; LANG=C ; export LC_ALL LANG
echo "Environment: LC_ALL = $LC_ALL, LANG = $LANG"
echo "(Versions displayed with local utility \"version\")"
version >/dev/null 2>&1 && version "=o" $(_eat $0 $1) edges cgrep
set -o nounset
FILES="data*"
# Paste files, see edges:
echo
echo " Sample content of files, pasted, line numbers added:"
paste $FILES |
expand -25 |
edges -l 3
echo
echo " Results:"
cgrep -h +N 11 '\.[0-9]' $FILES
exit 0
producing:
% ./s1
Environment: LC_ALL = C, LANG = C
(Versions displayed with local utility "version")
OS, ker|rel, machine: Linux, 2.6.26-2-amd64, x86_64
Distribution : Debian GNU/Linux 5.0
GNU bash 3.2.39
edges (local) 307
cgrep - (local: ~/executable/cgrep May 29 10:59 )
Sample content of files, pasted, line numbers added:
1 first line of data1 first line of data2
2 1.1 2.1
3 1.2 2.2
...
13 1.12 2.12
14 and so on, until and so on, until
15 the last line of data1 the last line of data2
Results:
1.12
2.12
The cgrep utility is available at the AT&T site as noted. Compilation was straight-forward on both 32-bit and 64-bit systems.
If you don't prefer this approach, the solution suggested by varontron will work (after a few modifications).
Best wishes ... cheers, drl