VirtualBox

source: kBuild/vendor/grep/2.12/tests/max-count-vs-context@ 3627

Last change on this file since 3627 was 2595, checked in by bird, 13 years ago

gnu grep version 2.12 (grep-2.12.tar.xz, md5sum=8d2f0346d08b13c18afb81f0e8aa1e2f)

File size: 476 bytes
Line 
1#!/bin/sh
2# Show how -m1 works with -A N when a 2nd match is < N lines after the first
3. "${srcdir=.}/init.sh"; path_prepend_ ../src
4
5cat <<EOF > in || framework_failure_
6needle
71st line of context
82nd line of context
93rd line of context
10another needle
115th line of context relative to first match
126th line...
13EOF
14
15sed 4q in > exp || framework_failure_
16
17fail=0
18grep -m1 -A5 needle in > out 2>err || fail=1
19
20compare exp out || fail=1
21compare /dev/null err || fail=1
22
23Exit $fail
Note: See TracBrowser for help on using the repository browser.

© 2025 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette