Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Dec 2006 00:04:47 -0500
From:      Parv <parv@pair.com>
To:        DeepTech <deeptech147@hotpop.com>
Cc:        freebsd-questions@freebsd.org
Subject:   OT: sed usage (was Re: Search & Replace Issue)
Message-ID:  <20061225050447.GB4228@holestein.holy.cow>
In-Reply-To: <458DFE11.1040201@hotpop.com>
References:  <458DFE11.1040201@hotpop.com>

next in thread | previous in thread | raw e-mail | index | archive | help
in message <458DFE11.1040201@hotpop.com>,
wrote DeepTech thusly...
>
> sed -e 's/http\:\/\/www\.domain\.htm\///g' *.htm > *.htm

That will most likely destroy the original file(s).

Depending on your shell, you will get redirection error from the shell
if there happen to be more than one file matching the pattern '*.htm'.

In particular, in zsh 4.2.6 ...

  # cat p
  polka dot

  # cp -f p q; cp -f p qq
  # ls -l p q*
  -rw-------  1 parv  people  10 Dec 24 23:32 p
  -rw-------  1 parv  people  10 Dec 24 23:32 q
  -rw-------  1 parv  people  10 Dec 24 23:32 qq

  # sed -e '' q* >| q*
  # ls -l q*
  -rw-------  1 parv  people  0 Dec 24 23:34 q
  -rw-------  1 parv  people  0 Dec 24 23:34 qq


> NOTE: not sure if u have to use a '\' before that ':'

No, ':' need not be escaped.


  - Parv

-- 




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20061225050447.GB4228>