fork download
  1. #!/bin/bash
  2. s="If the line was there is a loom in the gloom
  3. would you want that line printed?
  4. Just trying to understand if you're just
  5. other than as part of gloom
  6. if you really do want to exclude lines
  7. even when loom appears on it's own elsewhere on the line"
  8. grep -oPzn '(?m)^.*?\bgloom\b(?!(?:.*\R){2}.*?\belsewhere\b)(?:.*\R){2}.*\R?' <<< "$s"
Success #stdin #stdout 0.01s 5496KB
stdin
Standard input is empty
stdout
1:If the line was there is a loom in the gloom
would you want that line printed?
Just trying to understand if you're just