3

I have defined a format like this:

# header format
format STDOUT_TOP = 
pid    ppid   start_addr   uid   gid   state     vsz   rss     name 
--------------------------------------------------------------------------
.

# data format
format STDOUT = 
@>>>  @>>>   @>>>>>>>>>>  @>>>  @>>>  @>>>    @>>>>>  @>>>  @<<<<<<<<<<<<<<<<<<<
$pid, $ppid, $h_next,     $uid, $gid, $state, $vm,    $rss, $name
.

When I call write everything works great when I am printing to STDOUT, but I am processing a lot of data and it takes more than page to display; the ideal way for me or someone else to examine it would be with less. When I pipe the output of my program to less, a ^L character gets printed before the header at every new page of output.

screenshot: output of my program piped to less

Is there some way around this? Because if that character is printed then my header is misaligned with my data.

Any help would be appreciated.

xhienne
  • 5,738
  • 1
  • 15
  • 34
Hunter McMillen
  • 59,865
  • 24
  • 119
  • 170
  • You can assign a big value to a special variable `$=` to indicate that your page has big number of lines. But you will lose header strings at the top of each page in your output, because there will be only one page – mcsi Mar 29 '12 at 06:21
  • I'd just ignore the form feed and get on with life. – brian d foy Mar 29 '12 at 07:03
  • @briandfoy That would be nice if I wanted to to turn this in then get marked down for misaligned formatting. – Hunter McMillen Mar 29 '12 at 14:36

1 Answers1

6

That's an ASCII formfeed. It's probably being printed in both cases, but less is actually displaying it. According to perlform and perlvar, perl is outputting the contents of $^L (or $FORMAT_FORMFEED under use English). Try setting that var to the empty string or a newline.

Josh Y.
  • 876
  • 1
  • 6
  • 6