Skip to content

Instantly share code, notes, and snippets.

@baldwinsung
Created October 21, 2024 22:12
Show Gist options
  • Save baldwinsung/0660ded205ef2e8663cf2e1c0754886e to your computer and use it in GitHub Desktop.
Save baldwinsung/0660ded205ef2e8663cf2e1c0754886e to your computer and use it in GitHub Desktop.
just need the ip network. not the entire ip address
#!/usr/bin/env python3
import re
import sys
foo = "192.168.1.1"
bar = re.sub (r'\b(\d+\.\d+\.\d+)\.\d+\b', r'\1.0', foo )
print (bar)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment