Live data from Hacker News

The Sed FAQ

pement.org

11–15 of 15 posts

Re: The Sed FAQ

#11
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!

Re: The Sed FAQ

#12

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!

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

Re: The Sed FAQ

#13

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!

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

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.

Re: The Sed FAQ

#14

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!

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

Perl regexes are PCRE-like, PCRE regexes are Perl-like, they are not the same.

Re: The Sed FAQ

#15
post #8

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 d ~/.ssh/known_hosts and I'm done. Obviously I don't do that thoughtlessly otherwise I'd just disable ssh hosts checking altogether.

Isn't that what "ssh-keygen -R" command is for? Though I agree that your solution is more generic.
Post reply on HN