Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

4
  • Hmm, this does not output anything on my machine (OS X) Commented Jul 1, 2015 at 20:10
  • @AmelioVazquez-Reina sorry about that..i did not know your OS before..anyway i have tested this on Ubuntu.. Commented Jul 1, 2015 at 20:12
  • 2
    This would have the same problem as kos's (now deleted) solution as if there are duplicate lines in the input file and some of them fall outside the range and others are inside that range this will delete them all. Also, with multiple occurrences of pattern, if there are lines like -- in the input file (outside the ranges) this will delete them because the delimiter -- appears in grep's output when more then one line is matching pattern (the latter is highly unlikely but worth mentioning I guess). Commented Jul 1, 2015 at 21:41
  • @don_crissti Thanks..you are right..although i was taking OP's example literally..i am gonna leave it in case someone find it helpful later.. Commented Jul 2, 2015 at 14:14