[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: help



 
    
Swenson Deng wrote:
Hi, Mr. Miao,

I downloaded
ftp://igloo.its.unimacq.edu.au/pub/Oxford_Dictionary/

but what can I do with these files? no scripts?

swenson,
shenzhen, china.
Hello Swenson,

Here is scripts I use to search words in Oxford dictionary:

1. a gawk script mainly do the job:

#!/bin/gawk -f

#

# This program should be running with gawk
#
# Usage:
#        search --assign word=xxx dictionary_file
#
#
 

BEGIN {

    printf "Searching Word: [ %s ]\n\n", word

 counter = 0

    while (getline a_line) {

 
  counter = counter + 1

        if (index (a_line, word)) {

   if ((counter % 2) == 1) {

    printf "%s\n", a_line

    getline a_line

    counter = counter + 1

    printf "%s\n", a_line

   }
   else {
    printf "%s\n", old_line
    printf "%s\n", a_line
   }
        }

  old_line = a_line

    }
}

2. a shell script to reduce typing work:

 
#! /bin/csh

echo "----------------------------------------------------------------"

echo "Search Engine for [ $2 ] " 
echo ""
# cat $HOME/projects/gre/$1.dic|grep $2

$HOME/bin/gg --assign word=$2 projects/gre/$1.dic | more
Each time while I am searching a word, e.g, I type:

[terrence@igloo terrence]$ s z zealous

----------------------------------------------------------------
Search Engine for [ zealous ]

Searching Word: [ zealous ]

zealous

/ 5zelEs; `zZlEs/ adj full of zeal; eager 热情的; 热心的; 积极的: zealous for li
berty and freedom 为争取自由而积极的 * zealous to succeed at work 一心要做好工作
.
zealously
adv.
zealotry
/ -rI; -rI/ n [U] (fml 文) zealous attitude or behaviour 极热心的态度或行为.

and give me just all the appearance of zealous in z.dic that I want.

You can modify the code and and more features you want.

Cheers,

-- 
Terrence Miao                       
ITSAD ET in The University of Macquarie         ...   __o         
(03) 8344 0361 terrence@xxxxxxxxxxxxxx        ...    -\<,  
http://igloo.its.unimacq.edu.au                ... (_)/(_) ..
Google