git: 0a88bd81b766 - main - awk: print the last two characters for bigram - not the second word
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 24 Jan 2022 18:30:02 UTC
The branch main has been updated by wosch: URL: https://cgit.FreeBSD.org/src/commit/?id=0a88bd81b76675288a0e62f5687c0c6dea710bc2 commit 0a88bd81b76675288a0e62f5687c0c6dea710bc2 Author: Wolfram Schneider <wosch@FreeBSD.org> AuthorDate: 2022-01-24 18:06:07 +0000 Commit: Wolfram Schneider <wosch@FreeBSD.org> CommitDate: 2022-01-24 18:27:43 +0000 awk: print the last two characters for bigram - not the second word A bigram may contain a space character, and we always need two characters. --- usr.bin/locate/locate/concatdb.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/usr.bin/locate/locate/concatdb.sh b/usr.bin/locate/locate/concatdb.sh index 28eb2d921c16..d9832cfbef5a 100644 --- a/usr.bin/locate/locate/concatdb.sh +++ b/usr.bin/locate/locate/concatdb.sh @@ -68,7 +68,8 @@ trap 'rm -f $bigrams' 0 1 2 3 5 10 15 for db do $locate -d $db / -done | $bigram | $sort -nr | awk 'NR <= 128 { printf $2 }' > $bigrams +done | $bigram | $sort -nr | \ + awk 'NR <= 128 && /^[ \t]*[1-9][0-9]*[ \t]+..$/ { printf("%s", substr($0, length($0)-1, 2)) }' > $bigrams for db do