From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by finch.gentoo.org (Postfix) with ESMTPS id E501B138206 for ; Wed, 17 Jan 2018 07:17:43 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id B36A9E0928; Wed, 17 Jan 2018 07:17:36 +0000 (UTC) Received: from mail-io0-x22f.google.com (mail-io0-x22f.google.com [IPv6:2607:f8b0:4001:c06::22f]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 54FA7E08FA for ; Wed, 17 Jan 2018 07:17:36 +0000 (UTC) Received: by mail-io0-x22f.google.com with SMTP id f89so11663887ioj.4 for ; Tue, 16 Jan 2018 23:17:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=7mv7tuvAWZXooVP92Hstm8I1Zf+sYCFWM4CdaWmoTxY=; b=g2Y3aUWVLMl9eb10sI+V79vGNDEr6mHfGscfA2XIKfPM7q0Wwx0n3J4HVE4qULX5Uo yG0B7pboLTw4pNVsRiRVDp1I3lmPoWXMbEUQSnPiHE7DL0yDXJnYgRmeFdZEz5kHHAO/ 2ihzkwaYVS/Q7DGNGaLuM+hKSMiNcyh19rb/7/OPIrZ6ZjWxQSX8sHbDVSud2EAPe4AF zJurDqZB3Idbb5PKMJVyrciAQjb04dMsNMpTDNYQtMc5qzOZPYg+GSdtsUe80f/urbIi HsoglLCBx24al5UBFgXifh9YKDYZIi5QfFKPeTR7NO5VBB5vsG53gEK+gakIZD1ENSnH 9sXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=7mv7tuvAWZXooVP92Hstm8I1Zf+sYCFWM4CdaWmoTxY=; b=lHwxIdigF0BV544PAdzjHvx7u5DqdUOab/Yd31Jq3ST/D7ZaS2yeqz139x/O0nKOJE N+u7iZINNfs8zSVB5JThjJ/6G4ZiLzY4aWKZ/rURTfHLFdfARaAU6lOKRPbbiFhkLYhT jnxhWSujah6z78PDrPH/aNog2mmLSNbCuBpqVXlS73yugK0IRpjc3A1LQECiGTWaluS4 4meVWtClh4U2ZejCtRaiUAmP0gZp4VTtNYWQybccp15HosoewNAZFw6ZJHTr/bGGp/GV uapnRWgMch58Ajq6dKZcO8LwQPx9eZowV59Nl42vfegNz5k6oloMkEvOUeZFYoz1Nr3h stNQ== X-Gm-Message-State: AKwxytdWYjr7aLzsmvB63xMXtWbOfldommVla8hdzqFpC4Ya+6QVzTC3 IBvpFk4UPYC407DCsmFdRhbs9XuZiEQroMCGWIYqPYrR X-Google-Smtp-Source: ACJfBovEt7jf/SfOWaF+Z4IkMtQvyO9Q+aiub/cQauyL4pRSvLiAEMXi2a2SpnY0mKi2+704oKIyE4b0BwRgAaYa9yU= X-Received: by 10.107.138.20 with SMTP id m20mr13999084iod.192.1516173455105; Tue, 16 Jan 2018 23:17:35 -0800 (PST) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-user@lists.gentoo.org Reply-to: gentoo-user@lists.gentoo.org MIME-Version: 1.0 Received: by 10.79.32.205 with HTTP; Tue, 16 Jan 2018 23:16:54 -0800 (PST) In-Reply-To: References: From: Alexander Kapshuk Date: Wed, 17 Jan 2018 09:16:54 +0200 Message-ID: Subject: Re: [gentoo-user] OT awk question To: Gentoo mailing list Content-Type: text/plain; charset="UTF-8" X-Archives-Salt: 47cab46c-c433-4e21-9aac-b7886522379a X-Archives-Hash: 0152290365411b52ef14ca6228914e73 On Wed, Jan 17, 2018 at 3:49 AM, Adam Carter wrote: > I'm using this to grab a section of text across multiple lines, how do i get > it to exit after the first match? > > awk '/foo/,/bar/' See if this works for you: awk '/foo/,/bar/{print;if(/bar/)exit}' file sed '/foo/,/bar/!d;/bar/q' file