| 
            Last change
 on this file was             3529, checked in by bird, 4 years ago           | 
        
        
          | 
             
Imported grep 3.7 from grep-3.7.tar.gz (sha256: c22b0cf2d4f6bbe599c902387e8058990e1eee99aef333a203829e5fd3dbb342), applying minimal auto-props. 
 
           | 
        
        
          
            
              - 
Property                 svn:executable
 set to                 
*
               
             
           | 
        
        
          | 
            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 | 
 | 
|---|
| 5 | cat <<EOF > in || framework_failure_
 | 
|---|
| 6 | needle
 | 
|---|
| 7 | 1st line of context
 | 
|---|
| 8 | 2nd line of context
 | 
|---|
| 9 | 3rd line of context
 | 
|---|
| 10 | another needle
 | 
|---|
| 11 | 5th line of context relative to first match
 | 
|---|
| 12 | 6th line...
 | 
|---|
| 13 | EOF
 | 
|---|
| 14 | 
 | 
|---|
| 15 | sed 6q in > exp || framework_failure_
 | 
|---|
| 16 | 
 | 
|---|
| 17 | fail=0
 | 
|---|
| 18 | grep -m1 -A5 needle in > out 2>err || fail=1
 | 
|---|
| 19 | 
 | 
|---|
| 20 | compare exp out || fail=1
 | 
|---|
| 21 | compare /dev/null err || fail=1
 | 
|---|
| 22 | 
 | 
|---|
| 23 | Exit $fail
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.