[review,gdb/contrib] Improve words extraction in words.sh script

Message ID gerrit.1573811593000.I1d9eea165731af4e6c4e1c7e09aed9b07af6395c@gnutoolchain-gerrit.osci.io
State New, archived
Headers

Commit Message

Simon Marchi (Code Review) Nov. 15, 2019, 9:53 a.m. UTC
  Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/655
......................................................................

[gdb/contrib] Improve words extraction in words.sh script

Remove more punctuation and quoting in words.sh script.

gdb/ChangeLog:

2019-11-15  Tom de Vries  <tdevries@suse.de>

	* contrib/words.sh: Improve words extraction.

Change-Id: I1d9eea165731af4e6c4e1c7e09aed9b07af6395c
---
M gdb/contrib/words.sh
1 file changed, 2 insertions(+), 1 deletion(-)
  

Comments

Simon Marchi (Code Review) Nov. 22, 2019, 3:50 a.m. UTC | #1
Kevin Buettner has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/655
......................................................................


Patch Set 1: Code-Review+2

(1 comment)

One small nit, otherwise it looks good to me.  Just fix the tab - if it's actually missing - and then push.

| --- gdb/contrib/words.sh
| +++ gdb/contrib/words.sh
| @@ -124,17 +124,18 @@ if $c; then
|  	-- "$@"
|  else
|      cat "$@"
|  fi \
|      | sed \
| -	  -e 's/[%^$~#{}`&=@,. \t\/_()|<>\+\*-]/\n/g' \
| +	  -e 's/[!"?;:%^$~#{}`&=@,. \t\/_()|<>\+\*-]/\n/g' \
|  	  -e 's/\[/\n/g' \
|  	  -e 's/\]/\n/g' \
| +          -e "s/'/\n/g" \

PS1, Line 132:

Is there a missing tab on this line?

|  	  -e 's/[0-9][0-9]*/\n/g' \
|  	  -e 's/[ \t]*//g' \
|      | tr '[:upper:]' '[:lower:]' \
|      | sort \
|      | uniq -c \
|      | awk "{ if (($minfreq == 0 || $minfreq <= \$1) \
|                   && ($maxfreq == 0 || \$1 <= $maxfreq)) { print \$0; } }" \
|      | awk '{ print length($0) " " $0; }' \
|      | sort -n -r \
  

Patch

diff --git a/gdb/contrib/words.sh b/gdb/contrib/words.sh
index e48b82e..a1c2cce 100755
--- a/gdb/contrib/words.sh
+++ b/gdb/contrib/words.sh
@@ -126,9 +126,10 @@ 
     cat "$@"
 fi \
     | sed \
-	  -e 's/[%^$~#{}`&=@,. \t\/_()|<>\+\*-]/\n/g' \
+	  -e 's/[!"?;:%^$~#{}`&=@,. \t\/_()|<>\+\*-]/\n/g' \
 	  -e 's/\[/\n/g' \
 	  -e 's/\]/\n/g' \
+          -e "s/'/\n/g" \
 	  -e 's/[0-9][0-9]*/\n/g' \
 	  -e 's/[ \t]*//g' \
     | tr '[:upper:]' '[:lower:]' \