Mailinglist Archive: opensuse (3349 mails)

< Previous Next >
Re: [SLE] editor for extremely large test file
  • From: Colin Carter <colincarter@xxxxxxxxxxxxxx>
  • Date: Thu, 12 May 2005 09:59:19 +1000
  • Message-id: <200505120959.19420.colincarter@xxxxxxxxxxxxxx>
On Thursday 12 May 2005 03:09, Anders Johansson wrote:
> 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

Thanks Anders.
I am a beginner with grep (&Linux),
so I only use grep in 'gentle' ways as yet.
Regards,
Colin

< Previous Next >