Your message dated Tue, 06 Dec 2016 21:48:40 +0000
with message-id <[email protected]>
and subject line Bug#537898: fixed in edict 2016.12.06-1
has caused the Debian Bug report #537898,
regarding bash script to help grepping edict
to be marked as done.
This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.
(NB: If you are a system administrator and have no idea what this
message is talking about, this may indicate a serious mail system
misconfiguration somewhere. Please contact [email protected]
immediately.)
--
537898: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=537898
Debian Bug Tracking System
Contact [email protected] with problems
--- Begin Message ---
Package: edict
Version: 2009.03.03-1
Severity: wishlist
Tags: patch
There are a number of interfaces to edict in several environments,
including GTK, emacs, and command-line (xjdic, which unfortunately
won't work in modern UTF-8 terminals). Even then, I find myself
running grep on edict very often. The queries I make have a great
deal of regularity to them --- searching for whole words or exact
fields or common entries and so on --- so I ended up writing a bash
script which works kind of like a xjdic-lite.
I thought other people might find this script convenient, perhaps
enough so to bundle it with the edict package (or make a separate
one?), so I submit it to the maintainer's discretion; if you think it
sounds useful, feel free to distribute it; if you think it's bloat, no
hard feelings here.
-- System Information:
Debian Release: squeeze/sid
APT prefers unstable
APT policy: (500, 'unstable')
Architecture: i386 (i686)
Kernel: Linux 2.6.29-2-686 (SMP w/1 CPU core)
Locale: LANG=ja_JP.UTF-8, LC_CTYPE=ja_JP.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
edict depends on no packages.
edict recommends no packages.
Versions of packages edict suggests:
ii lookup 1.08b-10 interactive utility to search text
-- no debconf information
#!/bin/bash
set -e
common=n
word=n
exact=n
case_sensitive=n
encoding="$(locale -k charmap|sed -e 's/.*="\([^"]*\)"/\1/')"
edict=/usr/share/edict/edict
function usage()
{
cat <<EOF
Usage: $(basename $0) [options] <query>...
Options:
-c: Match only common entries.
-w: Word match; each English query must match whole words only.
-e: Exact match; each query must match an entire edict field.
-s: Make English queries case-sensitive (default is insensitive).
-f EDICT_FILE: Path to edict (default: $edict).
This program assumes edict is in the original EUC-JP encoding.
-c Current terminal character encoding (default: $encoding).
-h: Show this message.
If you use multiple queries, it is like an AND search (that is,
\$ $(basename $0) cold war
will match all entries mentioning both 'cold' and 'war'. To
search for an exact sentence, use shell escaping:
\$ $(basename $0) "cold war"
(and consider -e).
Be sure to put the queries only AFTER all options!
EOF
}
while getopts "cpwesf:c:h" opt; do
case $opt in
c|p) common=y;;
w) word=y;;
e) exact=y;;
s) case_sensitive=s;;
f) edict="$OPTARG";;
c) encoding="$OPTARG";;
h) usage; exit 0;;
*) usage; exit 1;;
esac
done
shift $(($OPTIND -1))
if ! [ "$encoding" ]; then
cat 1>&2 <<EOS
Error: could not guess terminal character encoding from \`locale -k charmap\`.
(You can use option -c as a workaround.)
EOS
fi
if ! [ -r "$edict" ]; then
echo "Error: could not read edict file \`$edict'." 2>&1
echo "Use option -f to specify the dictionary file." 2>&1
exit 1
fi
function encode()
{
iconv -f $encoding -t EUC-JP
}
function decode()
{
iconv -f EUC-JP -t $encoding
}
tmp1=$(mktemp)
tmp2=$(mktemp)
function cleanup()
{
rm -f $tmp1 $tmp2 2>&1
}
trap cleanup EXIT
declare -a queries
for arg in "$@"; do
regexp="$arg"
if [ $word == y ]; then
regexp="\<$regexp\>"
fi
if [ $exact == y ]; then
# catches kanji words at start of line
tmp="(^$regexp )"
# catches pronounciations (between brackets)
tmp+="|(\\[$regexp\\])"
# catches exact english queries, ignoring initial dictionary tags
# that are between parenthesis
tmp+="|(/(\\([^)]*\\) *)*$regexp)/"
regexp="$tmp"
fi
queries+=("$regexp")
done
grepopts='-E'
if ! [ $case_sensitive == y ]; then
grepopts+=' -i'
fi
first=y
for query in "${queries[@]}"; do
equery="$(echo "$query" | encode)"
if [ $first == y ]; then
first=n
grep $grepopts "$equery" "$edict" > $tmp1
else
grep $grepopts "$equery" $tmp1 > $tmp2 && cp $tmp2 $tmp1
fi
done
if [ $common == y ]; then
common_rg="$(echo '(P)' |encode)"
grep $grepopts "$common_rg" $tmp1 > $tmp2 && cp $tmp2 $tmp1
fi
# a last grep to color the matched parts
color_regexp=''
for query in "${queries[@]}"; do
color_regexp+="|($query)"
done
color_regexp="$(echo "$color_regexp"|encode)"
grep $grepopts --color=yes "$color_regexp" $tmp1|decode
cleanup
--- End Message ---
--- Begin Message ---
Source: edict
Source-Version: 2016.12.06-1
We believe that the bug you reported is fixed in the latest version of
edict, which is due to be installed in the Debian FTP archive.
A summary of the changes between this version and the previous one is
attached.
Thank you for reporting the bug, which will now be closed. If you
have further comments please address them to [email protected],
and the maintainer will reopen the bug report if appropriate.
Debian distribution maintenance software
pp.
Ludovic Drolez <[email protected]> (supplier of updated edict package)
(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing [email protected])
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Format: 1.8
Date: Tue, 06 Dec 2016 22:20:16 +0100
Source: edict
Binary: edict enamdict
Architecture: source all
Version: 2016.12.06-1
Distribution: unstable
Urgency: low
Maintainer: Ludovic Drolez <[email protected]>
Changed-By: Ludovic Drolez <[email protected]>
Description:
edict - English / Japanese dictionary
enamdict - Dictionary of Japanese proper names
Closes: 537898
Changes:
edict (2016.12.06-1) unstable; urgency=low
.
* New upstream release
* Added edict-grep command by Leonardo Boiko. Closes: #537898
Checksums-Sha1:
8aeaffc41917c90f3c933a2fcb6b5a99c2db07f7 1339 edict_2016.12.06-1.dsc
adc6b8e4caffd782be41864fbdf2e9738a26cb06 12977540 edict_2016.12.06.orig.tar.gz
c751a65c15b136f6a464ec031591a1117c3e31dc 20729 edict_2016.12.06-1.diff.gz
dc223447f08a5c8413ea1a18e3138732d60a07a1 3688368 edict_2016.12.06-1_all.deb
2c7b6017a9b8a24e27c3f60235968dc4ed74e546 4740
edict_2016.12.06-1_amd64.buildinfo
fcdd8eda2cfa344ee5d1543459334adf553a63da 5686104 enamdict_2016.12.06-1_all.deb
Checksums-Sha256:
788d42f34737b3f04d07f79b8ee6956310cb868722829a558b751ffdc2bc9c1c 1339
edict_2016.12.06-1.dsc
9854c92e5eee058264fa62b003e324489efff433ba203a61fd5b9a2f54f7f303 12977540
edict_2016.12.06.orig.tar.gz
b73a5d2d574254068be1cb61329ada3cfc2efa68d3d8a16463d75bbb161a8935 20729
edict_2016.12.06-1.diff.gz
ccfe8c859ec0949be6f235acfe867a925bd3904f74b450719b3a055be30ee6db 3688368
edict_2016.12.06-1_all.deb
e51268b3b57e0cdcc9f83394f2f6ea68393bb9f703dc92574fc9a32f28983bde 4740
edict_2016.12.06-1_amd64.buildinfo
0fd6c654b6f53c62999ec2b7df5b0edf00b385391b86a3d529623b0b34c78bf6 5686104
enamdict_2016.12.06-1_all.deb
Files:
921e9f810fc637799d51f9992b824640 1339 text optional edict_2016.12.06-1.dsc
484cefd3741fe96d57f190d342eb611c 12977540 text optional
edict_2016.12.06.orig.tar.gz
52be04f6427fd0a6db6ce5975304cae0 20729 text optional edict_2016.12.06-1.diff.gz
222a2a3ea27c4adc017b2843ac1e3683 3688368 text optional
edict_2016.12.06-1_all.deb
a72f7dff2e7d507fa9ba9e72d06b22c8 4740 text optional
edict_2016.12.06-1_amd64.buildinfo
c1dc67fde3a52959d239b20feb69b4b9 5686104 text optional
enamdict_2016.12.06-1_all.deb
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1
iQEcBAEBAgAGBQJYRy5QAAoJEIt1KBJH+cF8gx4H/A7sY1KGLiW/8eKNHK8XFYDX
M2eXnp3BG26Ll5G9aAswPDeCzekQtIhB3n85UeZtEtBBRYnLy0eFntXpTdCVMsul
Ggs58AWRsLtgHyih9Jr+JUMlVO9kSNKAW81p8RRB2DrpMqbwjrSCWwch+2eG5G8h
wha7fto9fUbz7nH1eO+eBbxGiMEMPfDGH+zV18NhkBf9Qm1fFlOcw871bv21W39s
0lk6xRGrjPGs7O89DrbgcsEvi5YfKJYehoKQratDoZkuGzJDLpDPoCV/JzMT/L34
LbQI05r5kcCNImmaNeP/d0GlAka8UBtGXQy0QdlkDfoWoepyqtvRk2oF5b8htKE=
=vWcr
-----END PGP SIGNATURE-----
--- End Message ---