Skip to Content.
Sympa Menu

baslinux - [BL] Scripts Using Sed (was: bash help; changing case of file names, hyperlinks) 56

baslinux AT lists.ibiblio.org

Subject: Baslinux mailing list

List archive

Chronological Thread  
  • From: Lee Forrest <lforrestster AT gmail.com>
  • To: baslinux AT lists.ibiblio.org
  • Subject: [BL] Scripts Using Sed (was: bash help; changing case of file names, hyperlinks) 56
  • Date: Sat, 24 Feb 2007 18:19:59 +0000

On Sat, Feb 24, 2007 at 11:53:37PM +0000, sindi keesan wrote:
[delete]
> I can also use $USER instead of `whoami`.
> Is the following correct?
>
> cat ~keesan/procmailrc.sample | sed -e "/keesan/$USER/g" >> ~/.procmailrc

The "-e" isn't necessary unless there is more than one expression:

sed -e 's/A/a/' -e 's/b/B/' # for example

You can also do that like so:

sed 's/A/a/;s/b/B/'

(There are many versions of sed, so watch out for exceptions to the above.)

Usually, to be on the safe side, when a variable is bounded by
something other than spaces or newlines, you should enclose it in
double quotes or like this: ${USER}

> There is only one occurrence of keesan. Do I need the g?

No. Your instincts are right on there. That means "global" and is necessary
only if there might be more than one instance on a _line_.

[delete]
>> Because of things like that, I think, Slackware and Linux kernel projects
>> are living for so long and still are actively maintained/developed -
>> they both have "benevolent dictators" that prevent such quarrels.

> So does BL, fortunately.

I couldn't agree more.

Lee

--
BasicLinux: Small is Beautiful
http://www.basiclinux.com.ru





Archive powered by MHonArc 2.6.24.

Top of Page