Given a typical known_hosts file:
[184.108.40.206]:22 ssh-rsa bbuivvhbkbjdnflksndkfnksnfk... [220.127.116.11]:14444 ssh-rsa hohdibsodbfoasbfbsabdfbsd... [18.104.22.168]:32209 ssh-rsa bksdjncknsdbcksbdcbhdhhb...
Not knowing the line# in the file, but knowing the ip address.
The following deletes all lines in the file:
sed '/98\.76\.54\.32/d known_hosts > known_hosts'
I'm hoping that I'm just missing something absurdly simple.
Testing my regex here gives me the match I need, and my impression is that:
sed '/pattern/d' file > file
Should drop just the first line where the /pattern/ is a match.
I know I'm no regex guru nor bash master, but I seriously thought this was not going to be a several search, two coffee battle. Can anyone throw me a bone?
EDIT: 4 answers in minutes and all right. I knew it was something ridiculous. Hopefully my folly shows up in someone else's searching.