Alex Rivera | Logout

Does . really match any character?

Asked 2012-03-13T10:22:35.920
13

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/--.*//' -

Edit
Report

1 Answer

6

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

This might help:

answered 2012-03-13T10:38:45.753

Your Answer