See attached 'test' file with some non-ASCII chars. $ cat test a�-�- Then; $ sed -i "s|.*|allgone|" test && cat test allgone�-�- Or (using fresh copy of 'test'); $ sed -i "s|.*|allgone|gi" test && cat test allgone�allgone�allgone Expected output in both cases would seem to be "allgone" on the line and nothing else? God Bless, Roel