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*

3
  • Note that in this particular case, you could replace the grep with a cut -d- -f2,3 to avoid the overhead of another regexp matching. Commented Jun 26, 2014 at 12:09
  • When I used this, I got newlines embedded because the grep expression matches two parts. I guess the expression could be fixed but using cut sorts it. However, it's brittle: say the file was mypackage-other the fied numbers would be out. The other answer may be less efficient (not really an issue here) but it does work. Commented Jun 26, 2014 at 13:19
  • Yep, just thought it was nice to reuse the regex exactly Commented Jun 26, 2014 at 13:19