#!/usr/bin/env bash

[[ -z $1 ]] && echo "No file given" && exit 1

for fname in "$@"; do
	fname=`realpath "$fname"`

	[[ ! -f $fname ]] && echo "No such file" && exit 1


	#ensure we have Windows file
	#"\x0D" = \r
#	crlf=`grep -U $'\x0D' $fname | wc -l`

#	[[ $crlf > 0 ]] &&

	grep -qU $'\x0D' $fname &&
		#echo "Converting $fname to unix" &&
		dos2unix $fname
done



#another example to convert
#tr -d '\r' < /hive-config/network/http_proxy.txt > /tmp/http_proxy.txt
