Tuesday, February 4, 2020

Re: Triplicate text after mix-matching vim and nvi

On 2020-02-04 09:03, 'Ottavio Caruso' via vim_use wrote:
> I have a file (man-pages.txt) where I have a list of man pages that
> I need to expand, for example:
>
> man 8 tcpdump
> man 1 login
> man 8 sysctl
> man 8 adduser
> man 5 adduser.conf
> man 8 rmuser
> man 8 useradd
> man 8 userdel

While I suggested using ":1m$" elsewhere in the thread, I'm glad I'm
not the only one doing something similar with man-pages.

However, I've used calendar programs to do this. You can either use
the venerable calendar(1) format:

# BSD date(1)
$ d=$(date +%s); while read line ; do printf '%s\t%s\n' $(date
-r $d +%Y-%m-%d ) "$line" ; d=$(( $d + (60*60*24) )); done <
list_of_manpages.txt >> ~/.calendar

# Linux date(1)
$ d=$(date +%s) ; while read line ; do printf '%s\t%s\n'
$(date --date="@$d" +%Y-%m-%d) "$line" ; d=$(( $d + (60*60*24) )) ;
done < list_of_manpages.txt >> ~/.calendar

(though beware that, if you have more than 365 entries, calendar(1)
seems to ignore the year)

You can then invoke

$ calendar

(or put it in a cron-job if it's not automatically picked up by your
system scripts)

I do something similar using remind(1) which I prefer for calendaring:

$ cat remify_manpages.awk
BEGIN {
print "SET ManStart date(2020,1,5)"
}
$7 ~ /^[1678]$/ {
printf("REM [ManStart + %i] MSG man %s %%\"%s%%\"%%\n", NR - 1, $7,
$6)
}

$ find /usr/share/man/man[1678]/ -maxdepth 2 -type f |
grep -vi perl |
sort -R |
awk -F'[./]' -f remify_manpages.awk > manpages.rem

(I ignore the perl man-pages and randomly shuffle them)

and then invoking remind(1) will include my man-page-of-the-day for
that given date.

-tim




--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20200204083930.5561f584%40bigbox.attlocal.net.

No comments:

Post a Comment