0

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

Here's my /etc/hosts

1.1.1.1 one
1.1.1.1 one.com
1.1.1.1 ONE
1.1.1.1 ONE.COM
2.2.2.2 TWO.COM
3.3.3.3 THREE.COM
3
  • this is my file. # cat /etc/hosts 1.1.1.1 one 1.1.1.1 one.com 1.1.1.1 ONE 1.1.1.1 ONE.COM 2.2.2.2 TWO.COM 3.3.3.3 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.