Does . really match any character?

Julio Guerra picture Julio Guerra · Mar 13, 2012 · Viewed 16.3k times · Source

I am using a very simple sed script removing comments : sed -e 's/--.*$//'

It works great until non-ascii characters are present in a comment, e.g.: -- °. This line does not match the regular expression and is not substituted.

Any idea how to get . to really match any character?


Solution :

Since file says it is an iso8859 text, LANG variable environment must be changed before calling sed : LANG=iso8859 sed -e 's/--.*//' -

Answer

Anonymoose picture Anonymoose · Mar 13, 2012

It works for me. It's probably a character encoding problem.

This might help: