I have a list that has data paired with IP addresses and I only want to see the IP address once and I don't want to change the order.
192.168.0.100 fred is happy 192.168.0.100 fred likes pie 192.168.0.100 pie is good 192.168.0.110 tom like cake 192.168.0.110 cake is good 192.168.0.110 pie is better 192.168.0.112 bill like lettuce 192.168.0.112 lettuce is good for you 192.168.0.112 cake and pie are better tasting than lettuce
WHat I want to do is just remove the duplicate IP address but leave everything exactly the same.
I want to make it look like this
192.168.0.100 fred is happy fred likes pie pie is good 192.168.0.110 tom like cake cake is good pie is better 192.168.0.112 bill like lettuce lettuce is good for you cake and pie are better tasting than lettuce
I don't want to touch any of the duplicate words and I can't change the order
Thank you if you can help
This will work no matter what kind of spacing and/or RE metacharacters are in the file:
Beware of solutions that use $1 in an RE context as those "."s in an IP address are RE metacharacters that mean "any character" so they might work for some sample data but you could get false matches given other input.