

The Sed FAQ - reader_1000
http://www.pement.org/sed/sedfaq.html

======
praptak
My favourite use case is when ssh complains about a host key being changed. I
just substitute the offending line number into this: sed -i <line_no>d
~/.ssh/known_hosts and I'm done. Obviously I don't do that thoughtlessly
otherwise I'd just disable ssh hosts checking altogether.

~~~
UNIXgod
actually that's a perfect use case for _ed_

for example:

Offending key in /home/user/.ssh/known_hosts:12

ed .ssh/known_hosts

12d

w

q

------
nickporter
I always have problems when running sed, especially with capture groups. I can
never get the syntax right for non-trivial stuff.

I wish there was a sed-like tool that used python or javascript regex syntax!

~~~
_delirium
perl -pe is my usual replacement for stuff where I want a sed-like filter but
PCRE syntax.

~~~
emmelaich
Yep, as soon as my sed gets even slightly complicated I reach for s2p (sed to
perl translator).

Also see a2p (awk to perl) and find2perl.

------
ISL
My traditional reference for sed syntax (though hardly so well-explained, it
can usually get the job done).

<https://www.google.com/search?q=sed+one+liners>

~~~
pkrumins
I love seeing my blog posts at the top. :)

------
McUsr
Hello. It is always nice with more stuff on sed, Here is a nice link for those
wanting to learn the basics: <http://www.grymoire.com/Unix/Sed.html>

------
elux
Needs a single page HTML version.

Single page text version here: <http://www.pement.org/sed/sedfaq.txt>

------
babuskov
Nice collection of one-liners:

<http://sed.sourceforge.net/sed1line.txt>

------
j0hnsn0w
Why not publish MAN itself

~~~
UNIXgod
Here you go!

<http://man.freebsd.org/sed>

also reading the ed man page will help as well for newbies.

\--------------------------

IEEE Std 1003.1-2008 :

[http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ed...](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ed.html)

[http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ex...](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/ex.html)

[http://pubs.opengroup.org/onlinepubs/9699919799/utilities/se...](http://pubs.opengroup.org/onlinepubs/9699919799/utilities/sed.html)

