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*

5
  • 1
    .*? is a non-greedy expression. Such expressions are not supported by POSIX tools in general as they are Perl-compatible expressions (PCRE). See unix.stackexchange.com/questions/119905 Commented May 7, 2020 at 18:36
  • @Kusalananda definitively a worthwhile read, thank you. If I omit the ? in the first group which denotes the adapter name, it still matches until :<blank> and \1 prints correctly. But substituting group 2 for the ip address with (.*\ ) won't work either. Why not and how can I search until the next blank? Commented May 7, 2020 at 19:10
  • 1
    Sine I don't use Linux and therefore do not have access to the ip tool nor know what the output looks like, I can't say for sure. To match a string of non-spaces, one usually do [^ ]*. Commented May 7, 2020 at 19:13
  • And what do you want to get ? Commented May 7, 2020 at 19:46
  • @ctac_ the output of the command is ok, it is lo: 127.0.0.1/8 eno1: 192.168.1.44/24 wlx68a3c45b2875: 192.168.1.36/24 The question was, why I can't substitute the group 2 for the ip address with (.*\ ) Kusalananda gave the correct hints. Commented May 7, 2020 at 20:16