Score:0

How do I show all ipv4 and ipv6 addresses by using grep

in flag
DOS

I'm trying to grep inet addr and inet 6 addr from ifconfig. I can grep inet addr or inet6 addr alone only.

How can I show both IPV4 and IPV6 addresses in one command?

Terrance avatar
id flag
`ifconfig | grep inet*` should be able to do it.
DOS avatar
in flag
DOS
Whew thank you so much. you saved me
hr flag
... you can always use `grep -e PAT1 -e PAT2 ...` to match multiple alternate patterns
Tilman avatar
cn flag
@Terrance The pattern should be enclosed in quotes: `grep 'inet*'` - to avoid surprises in case the current directory contains a file with a name starting with `inet`.
Terrance avatar
id flag
@Tilman It was only a 30 second comment. You can feel free to write an answer if you want. :)
Tilman avatar
cn flag
@Terrance I didn't mean to rebuke you, just to remove a possible source of perplexity for unsuspecting readers.
Bodo avatar
pt flag
@DOS You should [edit] your question and show the code you are trying, the input you use, the actual output you get and the desired output.
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.