1. The problem statement, all variables and given/known data:
Create a dictionary using cygwin. Display the following menu at the start of
execution
1-add a word in the dictionary # specify the meaning
2-search a word # if word exists, show the meaning of the word
2-delete a word
4-delete all words in the dictionary
#NOTE: The program should ask the user if he wishes to continue or not.
2. Relevant commands, code, scripts, algorithms:
grep,awk,sed
3. The attempts at a solution (include all code and scripts):
And here is my Code....
Code:
ans=yes
while [ $ans = yes ]
do
echo 1-Add a word in the dictionary
echo 2-Search a word in the dictionary
echo 3-Delete a word in the dictionary
echo 4-Delete all words in the dictionary
echo -n "Choose which to execute: "
read ENTRY
case $ENTRY in
1)
echo -n "Enter a word: "
read word
echo $word " " | cat >> word.txt
echo -n "Enter the meaning: "
read meaning
echo $meaning | cat >> word.txt
;;
2)
SUCCESS=0
echo -n "Enter the word to search: "
read word
grep -q "$word" "word.txt"
if [ $? -eq $SUCCESS ]
then
awk "/$word/" word.txt
else
echo Word not found!
fi
;;
3)
echo "Enter a word to delete: "
read word
grep "$word" word.txt | cat > word.txt
;;
4)
echo | cat > word.txt | echo Successfully Deleted!
;;
echo -n "Do you want to continue?yes or no: "
read ans
done
In the case 1 , I wanted that everytime I save a word & meaning to a notepad it
would appear like this in the notepad
#example
Clandestine means Secret
Loquacious means Talkative
but in my code, it appears like this in the notepad
#example
Clandestine means Secret Loquacious means Talkative
Can anybody help me with my code , especially in case 1 and case 3?
Your immediate response regarding this matter is so much appreciated
Thank you so much in advance ^_^ God bless ....
4. Complete Name of School (University), City (State), Country, Name of Professor, and Course Number (Link to Course):
AMA COMPUTER LEARNING CENTER/GENERAL SANTOS CITY/PHILIPPINES/MS. NARIN/ PRINCIPLES OF OPERATING SYSTEM (NO LINK AVAILABLE)
Note: Without school/professor/course information, you will be banned if you post here! You must complete the entire template (not just parts of it).
Last edited by pludi; 09-15-2011 at 01:22 PM..
Reason: Restored question. Please do not remove it even when it has been answered
I am working on a multilingual dictionary and I have data in three columns. The data structure can be
word=word=gloss
or
word word=word word=gloss gloss
= acts as a delimiter
The number of words separated by the delimiter can be up to 8 or 10. The structure is well defined in the sense... (6 Replies)
Hi ,
In Unix we have the command ,
"useradd" command ==> To create New user and
"groupadd" ==> To add New group &
Updates to /etc/group and /etc/passwd files will happen automatically.
How will i do the same in UNIX like environment in Windows (In Cygwin Bash promt).... (1 Reply)
I have a text file in UTF-8 format which has the following data structure
HEADWORD=gloss1,gloss2,gloss3 etc
I want to convert it so that all the glosses of the HeadWord appear on separate lines
HEADWORD=gloss1
HEADWORD=gloss2
HEADWORD=gloss3
An example will illustrate the requirement... (4 Replies)
I'm using cygwin on win7, What I would like to do is something like this:
cygstart cygwin tail -f /foo/test.log | perl -pe 's/error/\e
I know I can start a new instance using either of these:
mintty -e ...
cygstart tail ...
But neither of those open in ANSI mode, so I can't do... (0 Replies)
i am having a ms excel file which contains 2 columns, I first column i added words, and in second column meaning to the word in the first column. I want to create a dictionary for mobile like nokia or any java based application running mobile. How it can be created as i, dont know the java... (1 Reply)
Hey,
I am looking for an inbuilt unix dictionary.I tried to look at the path /usr/dict/word and I do not find anything any dict directory in the /usr folder. Can anyone please tell me how to find out this dictionary?
Thanks
Lee. (1 Reply)
Hi,
I inherited a .lib file that I need to use to make a .dll file from a c++ file. I am able to do this in visual studio but I can not do this using cygwin. I would like to build the dll using the commandline in order to create a make file. Can someone help me. I would really appreciate it.
... (0 Replies)
Has anyone ever encountered a good publication or site that is basically a NT(or DOS) to UNIX Dictionary / Translator (i.e. service = daemon or ren = mv, etc) - I've found lots of websites that list like 20 or so command equivalents, but that's about it- what about differences in system folders,... (3 Replies)
Could someone please tell me where the dictionary file for Spell is stored. And is it in a text format so I can read it in a windows text editor. Thanks (1 Reply)