groff
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Warn about long lines


From: Alejandro Colomar
Subject: Re: Warn about long lines
Date: Thu, 25 Aug 2022 18:54:53 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.1.2

Hi Ralph,

On 8/23/22 14:51, Ralph Corderoy wrote:
Hi Alejandro,

      ! groff -Tutf8 -man -ww longline.man |
      expand |
      grep '^.\{80\}.'

Ahh, I forgot about \{N\}, since I never use it.

Still, the Makefile uses pipefail, so I'm not sure how to make grep(1)
work for this.  If it works, it would be nice.

Move the inversion along the pipeline with a subshell.

     $ awk '{print FILENAME, length}' *
     79 79
     80 80
     81 81
     $
     $ set -o pipefail
     $ false | (! grep '^.\{80\}.' 79); echo $?
     1
     $ false | (! grep '^.\{80\}.' 80); echo $?
     1
     $ false | (! grep '^.\{80\}.' 81); echo $?
     
.................................................................................
     1
     $
     $ true | (! grep '^.\{80\}.' 79); echo $?
     0
     $ true | (! grep '^.\{80\}.' 80); echo $?
     0
     $ true | (! grep '^.\{80\}.' 81); echo $?
     
.................................................................................
     1
     $


May I tell groff(1) (grotty(1)) that the terminal width is 80, no matter what it actually is? Otherwise, I can only run the above in <=80-col terminals.

Cheers,

Alex
--
Alejandro Colomar
<http://www.alejandro-colomar.es/>

Attachment: OpenPGP_signature
Description: OpenPGP digital signature


reply via email to

[Prev in Thread] Current Thread [Next in Thread]