Mailinglist Archive: opensuse (3349 mails)

< Previous Next >
Re: [SLE] editor for extremely large test file
  • From: Anders Johansson <andjoh@xxxxxxxxxx>
  • Date: Wed, 11 May 2005 19:09:35 +0200
  • Message-id: <200505111909.35410.andjoh@xxxxxxxxxx>
On Wednesday 11 May 2005 13:23, Colin Carter wrote:
> You must have 'some' idea of the text for which you are searching.
> Write a C program which reads and searches, and when your search
> string is found dump, say a MB, to a file and note the position (character
> count) in the file.

There already is such a beast. It's called grep.

For example

grep -n -C 10000 "pattern" infile > outfile

will find the pattern in the infile and print it, along with the 10000
preceding and 10000 following lines into the file outfile, with each line
given its line number in the original file


< Previous Next >
Follow Ups