Created
January 29, 2013 17:05
-
-
Save palday/4665843 to your computer and use it in GitHub Desktop.
A few ways to find and get rid of NULL bites in documents.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tr < file-with-nulls -d '\000' > file-without-nulls | |
sed 's/\x0//g' file-with-nulls > file-without-nulls | |
sed 's/\x0/ /g' file-with-nulls > file-without-nulls | |
grep -P '\000' < file-with-nulls >file-without-nulls | |
awk '/\000/ { print }' | |
perl -ne 'print if m/\000/' | |
# python | |
f = open('file-with-nulls') | |
for l in f.readlines(): | |
print l.replace("\0", '') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment