Tag Info

Hot answers tagged

8

I think this should do it: tar -xzf file.tar.gz -C ~/locationX folder1 -C ~/locationY folder2 The -C option means to change to the specified directory before doing the extraction. Specifying filename arguments after the tarfile name restricts the extraction to just those files or directories. And you can repeat this -Changing directories as you do. Note ...


2

If you want to use grep, you can do: grep -av '^.*$' file in UTF-8 locales to get the lines that have at least an invalid UTF-8 sequence (this works with GNU Grep at least).


1

I find uconv (in icu-devtools package in Debian) useful to inspect UTF-8 data: $ print '\\xE9 \xe9 \u20ac \ud800\udc00 \U110000' | uconv --callback escape-c -t us \xE9 \xE9 \u20ac \xED\xA0\x80\xED\xB0\x80 \xF4\x90\x80\x80 (The \xs help spot the invalid characters (except for the false positive voluntarily introduced with a literal \xE9 above)). ...


1

Python has had a built-in unicode function since version 2.0. #!/usr/bin/env python2 import sys for line in sys.stdin: try: unicode(line, 'utf-8') except UnicodeDecodeError: sys.stdout.write(line) In Python 3, unicode has been folded into str. It needs to be passed a bytes-like object, here the underlying buffer objects for the ...



Only top voted, non community-wiki answers of a minimum length are eligible