The Translate command, tr, is available on all Unix-y systems, including Cygwin. tr -d will delete the specified characters from a stream. Several handy escape sequences are provided for stripping newlines, carriage returns, and form-feeds:
-
\f – form feed
\n – new line
\r – return
Since tr is deleting characters, not strings, we can simply specify all of these in a single command:
cat input.txt | tr -d \r\n\f > output.txt
Another way to assemble this command:
tr -d \r\n\f < input.txt > output.txt