Does grep-v support multiple keywords?
Requirement: to get the network card and its corresponding IP address.
We all know that we can use grep-v to filter out information that matches keywords. Use the grep command to get the information of the network card and the corresponding IP.
Ip addr | awk {'print $1J 2'} | grep-v link | grep-v valid | grep-v inet6
Through this combination of commands, you can get the information you want, but this command is a bit long, has it been done in one fell swoop?
Grep-v 'keyword1\ | keyword2' can filter out multiple keyword information at the same time. Combined with the command of sed, you can delete redundant keywords and easily obtain Nic and IP address information.
Ip addr | awk {'print $1 link 2'} | grep-v' link\ | valid_lft\ | inet6' | sed s/'inet'//g | sed sdebar'^ [0-9]:'/''/ g