Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.


Convert Form Feed to new line

Convert Form Feed to new line


I have never used Perl although I'm trying to modify some code.

From a unix system, a line of text might end with \f\n.
Is it possible to convert \f to \n so that the line would end with \n\n?

I have found the following although it doesn't appear to work.



I could also remove the \n and then \f


if ($temp=~/\n/) {
    if ($temp=~/\f/) {
Do this, I would like to add a \n although I'm not sure how.
I've tried a few things, such as



I don't know if I'm even using proper syntax or not.

Any help would be appreciated.


If at first you don't succeed, then sky diving wasn't meant for you!

RE: Convert Form Feed to new line

There is no \f char in Windows systems output strings, \r might be used instead.
With Perl you simply use \n that is converted, when sent to an output device, to the proper sequence depending on operating system.
If you want an additional new line in your string, just append a newline char: $temp.="\n"; : Online engineering calculations : Magnetic brakes for fun rides : Air bearing pads

RE: Convert Form Feed to new line

Hi prex1,

Thanks for the reply.
The file is being created on a unix system, processed through a program to convert it to a pdf file then viewed on a windows system.
I'm not entirely certain although I'm relatively confident that the file does have a \f.

I'll try your suggestion for appending a newline character.

Thank you.

If at first you don't succeed, then sky diving wasn't meant for you!

RE: Convert Form Feed to new line

the unix shell command tr (translate) is often used to accomplish that conversion

advanced cognitive capabilities and other marketing buzzwords explained with sarcastic simplicity

RE: Convert Form Feed to new line


Thanks for the reply and the information.
Good to know!

If at first you don't succeed, then sky diving wasn't meant for you!

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!


Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close