New Line Characters at end of line

awk '{sub("$","\r\n"); printf("%s",$0);}' inputfile > outputfile  # UNIX to DOS  (adding CRs on Linux and BSD based OS that haven't GNU extensions)

awk '{gsub("\r",""); print;}' inputfile > outputfile              # DOS to UNIX  (removing CRs on Linux and BSD based OS that haven't GNU extensions)

sed -e 's/$/\r/' inputfile > outputfile              # UNIX to DOS  (adding CRs on Linux based OS that use GNU extensions)

sed -e 's/\r$//' inputfile > outputfile              # DOS  to UNIX (removing CRs on Linux based OS that use GNU extensions)

cat inputfile | tr -d "\r" > outputfile              # DOS  to UNIX (removing CRs using tr(1). Not Unicode compliant.)

perl -pe 's/\r?\n|\r/\r\n/g' inputfile > outputfile  # Convert to DOS

perl -pe 's/\r?\n|\r/\n/g'   inputfile > outputfile  # Convert to UNIX

perl -pe 's/\r?\n|\r/\r/g'   inputfile > outputfile  # Convert to old Mac

Who's new

  • admin

Who's online

There are currently 0 users online.