Advertisement
voyeg3r

d2u

May 31st, 2015
509
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 0.34 KB | None | 0 0
  1. #!/usr/bin/env bash
  2.  
  3. # if (( ! $# )); then
  4. #     echo "Usage: $0:t input-dosfile output-unixfile"
  5. #     return 1
  6. # fi
  7.  
  8. outfile="${1}".utf-8
  9. cat "$1" > "$outfile"
  10.  
  11. codification="`file -bi "$1" | awk -F"=" '{print $NF}'`"
  12.  
  13. [[ "$codification" != "utf-8" ]]  && iconv -f ISO8859-9 -t UTF-8 "$1" > $outfile
  14.  
  15. sed -i 's/\x0D$//' $outfile
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement