[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: In serious need of some grep-fu
From: |
mw158979 |
Subject: |
Re: In serious need of some grep-fu |
Date: |
Sat, 21 May 2005 20:24:22 +0200 |
> The problem: I need to count the number of "bar's" between the "foo's".
> Any help would be GREATLY appreciated.
>
Do you mean 'bar's between the first and last foo'?
Do you have exactly 2 foo's?
Sed seems to be a better choice to multi-line dependencies like this -^.
Remember that Windows versionS are less friendly because of metacharacters.
Try to give for sed a script in "s.
Some tips:
sed "1,/foo/d" - eats lines to the first foo.
sed -n "1,/foo/p" - eats lines after the first foo.
grep -c bar - counts.
mw158979