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*

6
  • Thanks @sourcejedi . What does "...if a line is selected" mean exactly, and how does it interact with -c? The best I can tell, there are no errors, and either 0 or 1 shows up as expected. Commented Nov 9, 2016 at 19:36
  • 2
    selected = matches the regular expression; -c is just counting the matches -- it doesn't change the return code Commented Nov 9, 2016 at 19:58
  • OK, thanks @sourcejedi. I have to be careful about how I proceed because I work on a lot of systems, like BSDs, Solaris, Linux, OS X, etc. I need to try to stay very close to Posix. Is it possible to disable regular expression matching, and just match the token as a substring like 'Darwin'? It looks like -F is Posix and may do that, but I get the same result. I also dropped the -i and performed a comparison for Darwin and SunOS with no joy. Commented Nov 9, 2016 at 20:27
  • sorry, you're not making any sense to me. the example solution should be fully portable, right? Commented Nov 9, 2016 at 20:52
  • @sourcejedi - "you're not making any sense to me" - Sorry about that. " the example solution should be fully portable, right..." - I don't know. I'm a C/C++ guy. I struggle with scripting at times. Commented Nov 10, 2016 at 12:53