Subject: Re: bug#13786: pr command does not fold

From: Pádraig Brady <[email-masked]>
Date: Fri, 22 Feb 2013 23:17:39 +0000

tag 13786 notabug
close 13786
stop

On 02/22/2013 10:14 AM, Doh Smith wrote:
> Hi,
>
> I could not get the pr command to fold the lines. Is this a bug?
>
> I am using pr (GNU coreutils) 8.13 under GNU bash 4.2.24.
>
> Here is an example - the following pr command produced an output that
> instead of folding a long line of text in the first column, it cuts it off:
>
> $ echo "Snow with areas of blowing snow.  Low around 24. East wind around
> 15 mph, with gusts as high as 25 mph.  Chance of precipitation is 100%.
> Total nighttime snow accumulation of 2 to 4 inches possible." | pr -F
> --columns=2
>
> 2013-02-22 04:08                                                  Page 1
>
>
> Snow with areas of blowing snow.  L

fold or fmt are used to wrap text.
It can then be passed on to pr for
further layout and truncation:
You can paste this command to a terminal for illustration:

for i in $(seq 22); do
   clear
   seq -f '%03.f' 1 $i |
   fmt -w20 |
   pr -t -c2 -w40 -s'|'
   sleep 1
done

thanks,
Pádraig.