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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Replace FF character with CRLF

Status
Not open for further replies.

pfildes

Programmer
Jun 17, 2004
54
GB
Hi,

I have a need to replace a FF character (Form Feed) in a printer spool file with a CRLF (Carriage Return & Line Feed).

I previously replaced the FF character with a blank character using the TR command (e.g: tr '\014' ' '), but I now need to insert a blank line too.

Can anybody help please?
 
Perhaps a LF suffice ?
tr '\014' '\012'

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
That did work, but not quite how I expected. I need another blank line. I'd therefore need something like ; tr '\014' '\012\012'

Obviously, I can't do that because there's a mismatch of number of characters.

Is there any other method of doing this? Is it possible using 'sed'?
 
man awk


Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Or sed:

Code:
sed 's/^L//g' inputfile >outputfile

To enter the "^L" character in vi, use Ctrl-V Ctrl-L.

Annihilannic
[small]tgmlify - code syntax highlighting for your tek-tips posts[/small]
 
I tried many solutions which didnt give me the desired effect. I eventually went with the following;

Code:
tr '\014' '\012'

Seemed to work for me

Thanks to those who responded [smile]

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top