I'm writting a litlle bash script for debian. I want to find the 3th octet of my IPv4 and push it into "ip1" variable, and push the final octet in "ip2" variable. After some researches I found a script which is supposed to give me the first octet but i do not uderstant this part :
Some one could explain this to me and how can I adapt this to my needs.
I read this https://explainshell.com/... so I know how works -oP but still don't understand the last part.
ip1=$(ip a show | grep -oP '(?<=inet )[^.]+') ip2=$(ip a show | grep -oP '(?<=inet )[^.]+')