sed make me headache... need help!

I've still a little problem with sed.
So, the content of my file.txt is like:

101.10.20.2.1079 > 101.11.2.20.80:
101.10.20.2.1080 > 101.11.2.20.80:
101.10.20.2.1081 > 101.10.20.2..80:
101.05.15.143.1068 > tpo68-96-22-1.no.no.cox.net.4391:
101.05.15.143.1072 > bzq-130-119-40.pop.bezeqint.com.23373:
101.05.15.143.1073 > dhcp024-320-77-020.woh.rr.gr.32341:
server.2391 > 200.19.2.10.telnet:
server.2391 > google.com.www:
server.writesrv > 200.19.10.2.ssh:
server.xinuexpansion > gregor.ngu.com.www:

And i want only to delete the port, like so:

101.10.20.2 > 101.11.2.20
101.10.20.2 > 101.11.2.20
101.10.20.2 > 101.10.20.2
101.05.15.143 > tpo68-96-22-1.no.no.cox.net
101.05.15.143 > bzq-130-119-40.pop.bezeqint.com
101.05.15.143 > dhcp024-320-77-020.woh.rr.gr
server > 200.19.2.10
server > google.com
server > 200.19.10.2
server > gregor.ngu.com

Delete the ip address is easy but only the port is hard...
sed 's/\.*> //' file.txt
I don't see how to do that!
Has someone an idea?

Thankx

What about this?

testcn@bernardchan testcn$ sed -ne 's/\([^ ]*\)\.[0-9A-Za-z]\+/\1/g; s/:$//; p' < /tmp/file.txt
101.10.20.2 > 101.11.2.20
101.10.20.2 > 101.11.2.20
101.10.20.2 > 101.10.20.2.
101.05.15.143 > tpo68-96-22-1.no.no.cox.net
101.05.15.143 > bzq-130-119-40.pop.bezeqint.com
101.05.15.143 > dhcp024-320-77-020.woh.rr.gr
server > 200.19.2.10
server > google.com
server > 200.19.10.2
server > gregor.ngu.com

Single command:

sed 's/\(.*\)[.][0-9]* > \(.*\)[.][0-9a-z]*:/\1 > \2/' yourfile > yournewfile 

Hi reborg

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 \{\}?

rg nymus

It's probably easier if I explain the whole line:

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

Thank you for your explanation! Now it's very clear, i understood well.
Regards