I want to remove other entries and keep only the ONE.COM.

Here's my /etc/hosts one one.com ONE ONE.COM TWO.COM THREE.COM
  • this is my file. # cat /etc/hosts one one.com ONE ONE.COM TWO.COM THREE.COM – Mac Jordan Mendoza Derecho Feb 5 at 7:04
  • 1
    Well, I am tempted to be snarky and just say "what prevents you from doing it?". Seriously, just use a text editor and remove the superfluous lines. Or ask an actual question, or specify conditions like a special method, or a batch solution, etc. – berndbausch Feb 5 at 8:57
  • Please edit your question and explain why you don't simply do this manually. If you need to script it, I assume you can generalize it, right? Perhaps you want to remove all duplicates and always keep the last one? Otherwise, any automatic solution we give you will be no easier than manually editing the file. – terdon Feb 5 at 11:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.