------------------------------------------------------------------------------- End of line handling in text files... Note that Dos (\r\n) EOL is also used for network protocols. Programs "unix2dos" and "dos2unix" generally work well, but it is best NOT to give it a filenames as they do a lot of checking of file types etc. Instead pipe the files via STDIN/STDOUT. unix2dos < unix_results.txt > network_data But these commands are not always available. ------------------------------------------------------------------------------- Example mailing a file correctly to a smtp network connection Pure Bash only... exec {smtp}<>/dev/tcp/smtp.example.com/25 cat <&$smtp & ( # output headers # ... # Send results while IFS= read -r line; do printf '%s\r\n' "$line"; done < results.txt echo '.' printf 'QUIT\r\n' ) >&$smtp exec {smtp}>- wait -------------------------------------------------------------------------------