This sounds like a really banal question, and it's bugging me dearly.
I have a text file, generated by python, that contains a list of host names and ip addresses in the following format:
host46.provider.com = 192.168.0.1
However, because the file was generated asynchronously, there's a few strange errors in the output. I'm getting lines that look like this:
us9831.provider.com = 2184.108.40.206us9832.provider.com = 220.127.116.11
The problem is that it hasn't inserted a newline between the two instances. I've ascertained that (fortunately) the naming convention of the nodes doesn't allow for a number to come before a letter, unless it's before a dot (
So what I neeed to happen is:
- find an instance where a number comes before a dot
- add a newline between the two
I can't figure out how I'll get
sed to maintain the regex match, and copy that over to the next regex.
I've tried this:
cat eg | sed '/[0-9][a-z]/s/[0-9][a-z]/[0-9]\n[a-z]/'
and I have tried this:
cat eg | sed "s/[0-9][a-z]/\n/"
sed the right tool? Should I be using
Any suggestions would be warmly welcomed.