This shows you the differences between two versions of the page.
| — |
misc:bash_ip_split [2009/12/29 10:41] (current) Robin Wood created |
||
|---|---|---|---|
| Line 1: | Line 1: | ||
| + | ====== Splitting an IP in Bash ====== | ||
| + | This will split an IP address into its component parts | ||
| + | <code bash> | ||
| + | ip="192.168.0.1" | ||
| + | IFS="." | ||
| + | set -- $ip | ||
| + | echo "$1,$2,$3,$4" | ||
| + | </code> | ||