Created
May 16, 2018 20:54
-
-
Save ArneGockeln/5f6eb9b8845473b66eac8f82963e4fa7 to your computer and use it in GitHub Desktop.
This bash scripts removes nullbytes and dos special characters from fxcm csv files. Requires tr and dos2unix.
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
#!/bin/bash | |
#title :convert | |
#description :removes nullbytes and dos special characters from fxcm csv files | |
#author :Arne Gockeln, www.arnegockeln.com | |
#version :0.1 | |
#notes :requires tr and dos2unix | |
#================================================================================= | |
if [ $# -lt 1 ]; then | |
echo "This script removes nullbytes and dos special characters from fxcm csv files" | |
echo "Usage:" | |
echo " $0 /path/to/file.csv" | |
exit 1 | |
fi | |
INPUT=$1 | |
OUTPUT="${INPUT}_out" | |
# remove nullbyte | |
tr < $INPUT -d '\000' > $OUTPUT | |
# convert from dos 2 unix | |
dos2unix $OUTPUT | |
# move output to original file | |
cat $OUTPUT > $INPUT | |
# remove output | |
rm $OUTPUT |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment