For When You Can't Have The Real Thing
[ start | index | login ]
start > Linux > Useful sed

Useful sed

Created by dave. Last edited by dave, 5 years and 71 days ago. Viewed 1,304 times. #2
[diff] [history] [edit] [rdf]
labels
attachments
(2019-01-17)

Print line X from a text file

$ sed 'LINEq;d' FILE

Delete line X in a text file

$ sed -i LINEd FILE

...for example, .ssh/known_hosts:

$ sed -i 672d ~/.ssh/known_hosts

For some reason, ssh-keygen -R doesn't always work for me. But the sed command does.

no comments | post comment
This is a collection of techical information, much of it learned the hard way. Consider it a lab book or a /info directory. I doubt much of it will be of use to anyone else.

Useful:


snipsnap.org | Copyright 2000-2002 Matthias L. Jugel and Stephan J. Schmidt