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

login
register
mail settings
Submitter Simon Marchi (Code Review)
Date Nov. 15, 2019, 9:53 a.m.
Message ID <gerrit.1573811593000.I1d9eea165731af4e6c4e1c7e09aed9b07af6395c@gnutoolchain-gerrit.osci.io>
Download mbox | patch
Permalink /patch/35934/
State New
Headers show

Comments

Simon Marchi (Code Review) - Nov. 15, 2019, 9:53 a.m.
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(-)
Simon Marchi (Code Review) - Nov. 22, 2019, 3:50 a.m.
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:]' \