The usual sed command for global string search and replace is this:
where BRE stands for a "basic regular expression" and replacment is
used here as a stand-in for whatever actual replacement text is
intended. The "g" at the end has the effect of making the search and
replace "global", ie. to act on every match of the BRE instead of (by
default) the first instance on each line.
It looks like your sed command is constructed to be used within a
shell script, which is often the case. That would mean $1 takes its
value from the first command line argument following the name of the
invoked shell script.
Because your replacement string is empty, it has the effect of
deleting every matching instance in the input file.
So putting all these observations together, I will stick my neck out
and guess that the modified command should be:
I think the idea here is that you want to supply a "domain name" on
the command line, then have the shell script take (standard?) input
and remove every occurance of the URL www."domain name".com before
writing it to (standard?) out.
The backslashes here are "escape characters" that convert the period
into simply a literal period. Otherwise the period would have the
regular expression meaning of matching any single character (except
NUL). But an educated guess is that you are looking for the literal
periods as part of the specific URL as your matching pattern.
There are many sites on the Web that can tell you more about sed and
clever tricks it is useful for, but here's a starting point:
[sed -- Unix for Advanced Users]
Note in particular the explanation given there about "escaping" the
period in the search pattern (BRE), but this would not be needed in
the replacement string portion.
A fairly lengthy "man page" treatment of sed is here:
[sed -- stream editor]
with links to discussion of the basic regular expression syntax common
to other tools like awk and grep.
Before closing I'd like to say a few words about the shell scripting
environment and it's relationship to the proposed command, esp. the
use of double quotes.
What we have with a simple line like:
in a shell script is a template that the shell program (bash, for
instance) will act on before submitting for execution.
The text inside the double quotes will be massaged by the shell before
the sed program itself ever "sees" it. There is special treatment
within the double quotes for:
dollar signs ($)
back quotes (`)
and even more fundamental, the pair of double quotes "holds together"
the command string s/$1//g as a single "token", ensuring that when the
sed program sees its command line arguments, this command will be
treated as all one item.
As we mentioned before, the dollar sign follow by 1 ($1) will get
substituted out by the shell program, using instead whatever the first
argument was on the command line with the shell script executed that
contains this line. The shell also uses the backslash character to
"escape" special characters from this kind of substitution, e.g. if
you want to pass in a real dollar sign, say, as part of a command line
argument. In particular the backslash can be used to escape itself
within double quotes, so that sed will see a single backslash where
we've put \\ in the double quoted string for the shell. [Then,
finally, sed will apply that single backslash to escaping the period!
I won't go into what back quotes will do; it's a bit bizarre in
comparison to what we've discussed and quite irrelevant to the task at
hand. But if you'd like to learn more about Unix shells and quoted
strings on the command line, here's a place to start:
[Unix Shell Quote Tutorial by Bruce Barnett]
Give the suggestion above a shot, and please let me know if it doesn't
quite do what you hoped it would!