In Perl I would use a regular expression to match the text, then
end up with the string you're looking for in $1. So, for instance
#!/usr/bin/perl
open FILE, "< filename";
while (<FILE>) {
m/exp_here/;
print "I found '$1'\n";
}
close FILE;
Miark
On Tue, 19 Aug 2003 16:05:31 +0100, "Tony S. Sykes" <[EMAIL PROTECTED]> wrote:
> All,
>
> I am struggling writing a script which greps a binary file (grep -a)
> which will remove all of the data before the characters I am looking for
> and then to remove the data after another character so I have only the
> relevant info. When you grep the binary file the line is very long. I am
> looking for only about 15 - 20 characters off the line. The problem is
> that it can be anywhere on the line so I can't use a simple cut. Would
> "ed" be able to do this? I am not looking for you to write the script,
> just pointers as to what commands I could use. So far I have got the
> grep done "grep -a '@(#)' <file>" but it's what I do to the line after
> that.
>
> Thanks in advance,
>
> Tony.
Want to buy your Pack or Services from MandrakeSoft?
Go to http://www.mandrakestore.com