[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Regarding command Uses
From: |
Bob Proulx |
Subject: |
Re: Regarding command Uses |
Date: |
Thu, 17 Jan 2013 02:16:59 -0700 |
User-agent: |
Mutt/1.5.21 (2010-09-15) |
Gourav Khira wrote:
> Actually, i want to replace any word with another.i used "sed" command but
> it's not getting properly result.
> ...
> If,I want to replace here "this" with "that" using "sed" command.
>
> sed this that | filename
The sed manual has an entire section on substituting this for that in
section "3.5 The 's' Command". If sed is installed properly it will
include the documentation. You can read the documentation that is
installed with sed and therefore will be the matching version like
this:
info sed
Also the documentation for the most current release is available
online. The particular section I am referring to is here:
http://www.gnu.org/software/sed/manual/html_node/The-_0022s_0022-Command.html#The-_0022s_0022-Command
As a direct hint you need to do something like this:
sed s/this/that/g filename
If the patterns include any character that is special to the shell
then it will need to be quoted. The prefered Unix/GNU quoting style
is typically the single quote so that all (actually most) characters
are preserved verbatim. Ports to other operating systems may need
other quoting specific to that port.
sed 's/this spaced word/that spaced word/g' filename
Bob