Re: how to use sed

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, 2005-02-09 at 14:57 +0900, naxis wrote:
> Sorry to bother you with this but I want to know.
> I tried to use sed to change the perl path of my cgi scripts in a
> directory.
> from /usr/bonsaitools/bin/perl to /usr/bin/perl
> #sed 's/\/usr\/bonsaitools\/bin\/perl/\/usr\/bin\/perl/g' *.cgi
> it didnt work so I changed every thing one by one but I know sed can do
> the job for me.
> can someone teach me that?
> thank you

You didn't say how it didn't work. I created a file junk1:

[linush@lh4 ~]$ cat junk1
/usr/bonsaitools/bin/perl
/usr/bonsaitools/bin/perl
/usr/bonsaitools/bin/perl   /usr/bonsaitools/bin/perl

Then I copied and pasted the exact command you gave above:

[linush@lh4 ~]$ sed 's/\/usr\/bonsaitools\/bin\/perl/\/usr\/bin\/perl/g' junk1
/usr/bin/perl
/usr/bin/perl
/usr/bin/perl   /usr/bin/perl

It appears to work just fine. Are you aware that sed will not make
changes to the file, but rather sends the updated contents to stdout
unless you use -i?

-- 
C. Linus Hicks <lhicks at nc dot rr dot com>


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux