remove duplicated words in comments .. across lines

From: Justin Pryzby <pryzby(at)telsasoft(dot)com>
To: pgsql-docs(at)postgresql(dot)org
Subject: remove duplicated words in comments .. across lines
Date: 2018-08-27 16:23:37
Message-ID: 20180827162337.GA7954@telsasoft.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-docs

Inspired by David's patch [0], find attached fixing words duplicated, across
line boundaries.

I should probably just call the algorithm proprietary, but if you really wanted to know, I've suffered again through sed's black/slashes.

time find . -name '*.c' -o -name '*.h' |xargs sed -srn '/\/\*/!d; :l; /\*\//!{N; b l}; s/\n[[:space:]]*\*/\n/g; /(\<[[:alpha:]]{1,})\>\n[[:space:]]*\<\1\>/!d; s//>>&<</; p'

Alternately:
time for f in `find . -name '*.c' -o -name '*.h'`; do x=`<"$f" sed -rn '/\/\*/!d; :l; /\*\//!{N; b l}; s/\n[[:space:]]*\*/\n/g; /(\<[[:alpha:]]{1,})\>\n[[:space:]]*\<\1\>/!d; s//>>&<</; p'`; [ -n "$x" ] && echo "$f:" && echo "$x"; done |less

[0] https://www.postgresql.org/message-id/flat/CAKJS1f8du35u5DprpykWvgNEScxapbWYJdHq%2Bz06Wj3Y2KFPbw%40mail.gmail.com

PS. Not unrelated:
http://3.bp.blogspot.com/-qgW9kcbSh-Q/T5olkOrTWVI/AAAAAAAAAB0/BQhmO5AW_QQ/s1600/4de3efb5846e117e579edc91d6dceb9c.jpg

Attachment Content-Type Size
duplicated-words-across-lines.diff text/x-diff 5.8 KB

Browse pgsql-docs by date

  From Date Subject
Next Message Flavio Henrique Araque Gurgel 2018-08-28 14:26:30 Limitation of prepared statement name
Previous Message Bruce Momjian 2018-08-26 13:15:00 Re: Documentation does not cover multiple WITH in one query