Advertisement
dotancohen

Untitled

Mar 6th, 2014
184
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.27 KB | None | 0 0
  1. $ cat test
  2. foo
  3. a
  4. bar
  5. b
  6. 1 foo 2 bar 3
  7. 1 foo2bar 3
  8.  
  9.  
  10.  
  11.  
  12. bar
  13. a
  14. foo
  15. b
  16. 1 bar 2 foo 3
  17. 1 bar2foo 3
  18. $ pcregrep -M '(foo.*(.*\n){0,4}.*?bar)?(bar.*(.*\n){0,4}.*?foo)?' test
  19. foo
  20. a
  21. bar
  22. b
  23. 1 foo 2 bar 3
  24. 1 foo2bar 3
  25. bar
  26. a
  27. foo
  28. b
  29. 1 bar 2 foo 3
  30. 1 bar2foo
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement