Skip to Content.
Sympa Menu

baslinux - [BL] USING SED TO SUBSTITUTE: was Re: bash help; changing case of file names, hyperlinks

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: sindi keesan <keesan AT sdf.lonestar.org>
  • To: baslinux AT lists.ibiblio.org
  • Subject: [BL] USING SED TO SUBSTITUTE: was Re: bash help; changing case of file names, hyperlinks
  • Date: Sun, 25 Feb 2007 05:23:54 +0000 (UTC)

I made a testfile containing hello.



cat testfile | sed -e "/hello/bye/" > testfile2
I get the same file copied, with hello not bye.

I tried with and without -e and " "


cat testfile | sed /hello/goodbye/ > testfile3
sed: Unsupported command o
I get an empty file.

cat testfile | sed /hello/gbye > testfile4
sed: Can't find label for jump to `ye'


Where did I go wrong?


Sindi


man sed

Searched on substitute and found

[addr2]s/re/replacement/flags

and made a lucky guess at the meaning of it.



cat testfile | sed "s/hello/goodbye/" > testfile2 worked as expected.

You cannot add or subtract slashes but " " is optional here


s is for substitute, and without it the g and b in previous tests are misinterpreted?

Thanks to all for the script.

Sindi




Archive powered by MHonArc 2.6.24.

Top of Page