Given a typical known_hosts file:
[123.45.67.89]:22 ssh-rsa bbuivvhbkbjdnflksndkfnksnfk...
[98.76.54.32]:14444 ssh-rsa hohdibsodbfoasbfbsabdfbsd...
[77.34.122.33]: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.