Re: Multihomed Configuration



On Wed, Jun 13, 2007 at 11:34:53AM -0400, David Ford wrote:
sed -i -s "s/THE_PLACEHOLDER/$MYNEW/g" sshd_config

That requires GNU sed 4.0 or higher. Not everyone has that. It's
far better to use perl instead.

perl -pi -e "s/THE_PLACEHOLDER/$MYNEW/g" sshd_config

If you try your sed command on a non-GNU (or sufficiently old GNU)
system, you'll get an error:

pegasus:~$ sed -i s/hi/bye/ foo
sed: unknown option -- i
usage: sed script [-an] [file ...]
sed [-an] [-e script] ... [-f script_file] ... [file ...]



Relevant Pages

  • Re: sed/awk, instead of Perl
    ... Why use perl to execute a ... Perl for sed-ly stuff. ... wump$ ls -l Desktop/klog ... started to take off running the sed command. ...
    (freebsd-questions)
  • Re: Unix shell script with Perl one-liner causes error
    ... but the /g modifier is not right. ... Same with the sed command. ... You can of course also do that shell-for-loop in Perl. ...
    (comp.lang.perl.misc)
  • Re: Sed command in Perl
    ... > But if i include the sed command in perl it does not return any value. ... Check this FAQ ... for that you should use merely backticks or ...
    (perl.beginners)
  • Sed command in Perl
    ... How do I include a sed command in perl. ... online from McAfee. ...
    (perl.beginners)