Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Forcing carriage return in unix

Status
Not open for further replies.

kristolcrawley

Programmer
Jun 17, 2002
19
US
I know most people want to get rid of this BUT... how do I force a carriage return in unix. I'm creating a report that I'll send to the printer using lp. I tried putting ^M on the line but it just prints the actual characters. Also tried ^L & \n to no avail. Does it have to go at the end of a line? Can't I just pop the character(s) anywhere in the file and it'll jump to a new line when it see the characters?

Thanks for any help!
 
The carriage return char is:
Code:
 \r
or
Code:
 \015
.
If your printer is a PCL one, simply send
Code:
 \033&k2G
near the beginning of your report to force Lf to LfCr conversion.

Hope This Help
PH.
 
Try using [tt]unix2dos[/tt], or whatever you have on your system to convert a text file from Unix format to DOS or PC format. This carriage return is what those programs are converting to change the text format.

Hope this helps.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top