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:
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.
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.