Guest User

Untitled

a guest
May 21st, 2018
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.64 KB | None | 0 0
  1. #!/bin/bash
  2. #title :convert
  3. #description :removes nullbytes and dos special characters from fxcm csv files
  4. #author :Arne Gockeln, www.arnegockeln.com
  5. #version :0.1
  6. #notes :requires tr and dos2unix
  7. #=================================================================================
  8.  
  9. if [ $# -lt 1 ]; then
  10. echo "This script removes nullbytes and dos special characters from fxcm csv files"
  11. echo "Usage:"
  12. echo " $0 /path/to/file.csv"
  13. exit 1
  14. fi
  15.  
  16. INPUT=$1
  17. OUTPUT="${INPUT}_out"
  18. # remove nullbyte
  19. tr < $INPUT -d '\000' > $OUTPUT
  20. # convert from dos 2 unix
  21. dos2unix $OUTPUT
  22. # move output to original file
  23. cat $OUTPUT > $INPUT
  24. # remove output
  25. rm $OUTPUT
Add Comment
Please, Sign In to add comment