Great it works:)... Thankx a lot!
Could you please explain me, why the expression \(.*\)[.][0-9]* doesn't take the port number? Is the bracket \(\) egal to \{\}?
sed 's/\(.*\)[.][0-9]* > \(.*\)[.][0-9a-z]*:/\1 > \2/' yourfile > yournewfile
I'll illustreate with this line:
101.05.15.143.1068 > tpo68-96-22-1.no.no.cox.net.4391:
\(.\) matches any expression and stores it --> 101.05.15.143
[.][0-9] matches a '.' followed by a number --> .1069
" > " matches the space > space in the middle
\(.\) matches any expression and stores it --> tpo68-96-22-1.no.no.cox.net
[.][0-9a-z]: matches a '.' followed by any number of numbers or lowercase letters followed by a ':' --> .4391:
\1 > \2 first stored value followed by > followed by the second stored value --> 101.05.15.143 > tpo68-96-22-1.no.no.cox.net
Since I only stored the two hostname/ipaddress fields, but matched the entire line I then replace the entire input line by the two stored values and a ">" between them and the output becomes:
101.05.15.143 > tpo68-96-22-1.no.no.cox.net