Re: [dev] Re: I wrote a pager
On Sun, Sep 18, 2016 at 4:48 PM, Greg Reagle <greg.reagle_AT_umbc.edu> wrote:
> On Sun, Sep 18, 2016, at 09:34 AM, Christian Neukirchen wrote:
>> 1 loc!
>>
>> awk 'NR%22==0 { getline _ <"/dev/tty" } {print}'
>
> Great! And stali has awk. It works pretty well, but doesn't take into
> account long lines.
>
#!/bin/sh
IFS=' ' read l c << EOF
$(stty size)
EOF
cat "$_AT_" | fmt "-$c" -s | awk -v "l=$((l-1))" '!(NR%l){getline _<"/dev/tty"}1'
Or using rc:
#!/bin/rc
ifs='
' #space and newline
size=(`{stty size})
cat $* | fmt -$size(2) -s | awk -v l'='$size(1) '!(NR%(l-1)){getline
_<"/dev/tty"}1'
-emg
P.S. No this is not the best solution, I'm just having fun.
Received on Mon Sep 19 2016 - 15:16:02 CEST
This archive was generated by hypermail 2.3.0
: Mon Sep 19 2016 - 15:24:11 CEST