summaryrefslogtreecommitdiff
path: root/doc
diff options
context:
space:
mode:
authorJim Meyering <jim@meyering.net>1999-10-02 11:46:53 +0000
committerJim Meyering <jim@meyering.net>1999-10-02 11:46:53 +0000
commit46f2e4efeb2da93a2607fe020ed238b49c34cb96 (patch)
treee0616a9f05c871781d979a0c7fc4f45d79c65205 /doc
parent6c4caf0dbfc4421270627f48bfcee585cc59cc12 (diff)
downloadcoreutils-46f2e4efeb2da93a2607fe020ed238b49c34cb96.tar.xz
another example for tr -- illustrating problems with `-' in ranges..
Diffstat (limited to 'doc')
-rw-r--r--doc/textutils.texi10
1 files changed, 5 insertions, 5 deletions
diff --git a/doc/textutils.texi b/doc/textutils.texi
index 16dd7d5a4..b424302ec 100644
--- a/doc/textutils.texi
+++ b/doc/textutils.texi
@@ -3640,14 +3640,14 @@ to remove all @samp{a}s, @samp{x}s, and @samp{M}s you would do this:
tr -d axM
@end example
-However, when @samp{-} is one of those characters, it can be tricky
-because @samp{-} has special meanings.
-Performing the same task as above example but also
+However, when @samp{-} is one of those characters, it can be tricky because
+@samp{-} has special meanings. Performing the same task as above but also
removing all @samp{-} characters, we might try @code{tr -d -axM}, but
that would fail because @code{tr} would try to interpret @samp{-a} as
a command-line option. Alternatively, we could try putting the hyphen
inside the string, @code{tr -d a-xM}, but that wouldn't work either because
-it'd make @code{tr} remove all characters in the range @samp{a}@dots{}@samp{x}.
+it would make @code{tr} interpret @code{a-x} as the range of characters
+@samp{a}@dots{}@samp{x} rather than the three.
One way to solve the problem is to put the hyphen at the end of the list
of characters:
@@ -3656,7 +3656,7 @@ tr -d axM-
@end example
More generally, use the character class notation @code{[=c=]}
-where you'd put @samp{-} (or any other character) in place of the @samp{c}:
+with @samp{-} (or any other character) in place of the @samp{c}:
@example
tr -d '[=-=]axM'