On 04/20/2017 02:32 PM, Michael Klement wrote: > On macOS 10.12.4 (but not FreeBSD 10.1.2), Sed chokes on bytes that aren't valid in UTF-8 encoding, when using regex-based functionality: > > $ printf '\xfc\n' | sed -n '/./p' > sed: RE error: illegal byte sequence > That's locale dependent (should not happen with LC_ALL=C) - but it illustrates another nice point about POSIX text files: a text file may not have encoding errors, but as a corollary of that fact, there exist files which are text files in some locales but binary files in others! The behavior of sed is only specified when you have no encoding errors, so your choice of locale can indeed affect whether you get output that you wanted. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org