Re: Replacement of characters

Jacek Artymiak (artymiak@safenet.pl)
Tue, 09 Nov 1999 12:51:43 +0100


> how can I replace characters ^{[@` in a file.
> I'd like to do it in the entire directory and it's subidrectories.
> I tried it with sed but by the chars { and [ and ^ I ger error.

The [, ] and ^ are some of the "special" characters which must be
escaped, i.e. you need to put a \ in front of them in the pattern, e.g.

if you are trying to replace a string like:

^SED IS [EASY]

you'd neet to use this pattern:

/\^SED IS \[EASY\]/SED IS NOT SO EASY/

The reason you are having problems with { may be because you are trying
to put a \ in front of { or } in a pattern (e.g. to select a string like
\{tag}. Since \ is a special character too, you need to escape it in
the pattern as well, so instead of using \{ use \\{ and all should be
well.

-- 

Jacek Artymiak

------------------------------------------------------------------ Autor/Dziennikarz/Konsultant - Author/Journalist/Consultant

artymiak@safenet.pl, http://www.wszechnica.safenet.pl

co-author: StarOffice for Linux Bible (IDG Books Worldwide, Inc.) http://www.amazon.com/exec.obidos/ASIN/0764533630/polskawszechnica ------------------------------------------------------------------

- To unsubscribe from this list: send the line "unsubscribe linux-net" in the body of a message to majordomo@vger.rutgers.edu