Question

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.

Was it helpful?

Solution

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.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top