I need to do this to perform lookups on a customer database where the IP addresses are stored in the format with leading zeroes.
Thank you!
Try like this (run anywhere sample, replace first line with your actual search and update the field name). Two methods give, use any one.
| gentimes start=-1 | eval ip_addr="111.22.3.44 1.22.33.444 11.22.33.44" | table ip_addr | makemv ip_addr | mvexpand ip_addr
| eval ip_addr_modified=replace(replace(ip_addr,"(\d+)\.(\d+)\.(\d+)\.(\d+)","00\1.00\2.00\3.00\4"),"0*(\d{3})\.0*(\d{3})\.0*(\d{3})\.0*(\d{3})","\1.\2.\3.\4")
| eval ip_addr_modified2=replace("00".replace(ip_addr,"\.",".00"),"0*(\d{3})\.0*(\d{3})\.0*(\d{3})\.0*(\d{3})","\1.\2.\3.\4")
Try like this (run anywhere sample, replace first line with your actual search and update the field name). Two methods give, use any one.
| gentimes start=-1 | eval ip_addr="111.22.3.44 1.22.33.444 11.22.33.44" | table ip_addr | makemv ip_addr | mvexpand ip_addr
| eval ip_addr_modified=replace(replace(ip_addr,"(\d+)\.(\d+)\.(\d+)\.(\d+)","00\1.00\2.00\3.00\4"),"0*(\d{3})\.0*(\d{3})\.0*(\d{3})\.0*(\d{3})","\1.\2.\3.\4")
| eval ip_addr_modified2=replace("00".replace(ip_addr,"\.",".00"),"0*(\d{3})\.0*(\d{3})\.0*(\d{3})\.0*(\d{3})","\1.\2.\3.\4")
Works Great! Thank you very much!