1
This is my first post, and I am really appreciating all the answers which helped me so far on that website, I hope this is not a redundant post, but I couldn't find something similar here.
I try to split a String which I'll retrieve from a file into separate IPs.
The String would be like:
. something:[12.12.12.12],[13.13.13.13]
I am trying to do a String manipulation as described on tldp
expr "$string" : '\($substring\)'
When trying to escape a dot / period it won't find it:
testString=[12.12.12.12],[13.13.13.13]
echo `expr "$stringZ" : '\(\\[.{1,3}\..{1,3}\..{1,3}\..{1,3}\\]\)'`
I noticed, that I have to double escape [ and I tried to do so with the dot / period but it doesn't help.
How can I achieve that ?
Yes I know this regex is not very good, but I'd like to get the dot / period problem resolved first, before I do more on the regex.
Thanks a lot
What are you trying to do? Store the IPs in an array? – choroba – 2015-11-03T13:00:01.090
Yes, or then as a "space separated" string which i could go through easily with a for loop. – Andreas Grimm – 2015-11-04T14:00:00.907