Re: How can I search only a portion of a file?

From: Ignacio J. Vidal (ijvidal@sinectis.com.ar)
Date: Thu Jul 18 2002 - 18:28:40 EDT


> At 12:11 PM 7/17/2002, Ignacio Vidal wrote:
> >Maybe using awk with an internal variable that counts the
> occurence of
> >"A" until occurence of "> uniquestringABC" ?
>
> Sure, like so:
>
> awk '/uniquestringABC/ { exit; }
> /^A$/ { print; }' file
>
> And how about:
>
> sed -ne '/uniquestringABC/q' -e '/^A$/p' file | wc -l

Very nice.



This archive was generated by hypermail 2.1.7 : Wed Apr 09 2008 - 22:16:04 EDT