Sponsored Content
Top Forums Shell Programming and Scripting Pleas help..this is driving me crazy Post 302194510 by hckygoli31 on Tuesday 13th of May 2008 04:59:28 AM
Old 05-13-2008
Pleas help..this is driving me crazy

Hi, I've created a script in csh that takes a file and checks it for mispelled words. Im almost done but I need to do two more things but I need help.

First, when displaying an incorrect word to the user, I need to show the line of the input file that contains the word.
Second,if the user gives a replacement word, then I need to actually replace the word in the input file.

heres my code ...........

Code:
#!/bin/csh
#script that will spell check a file

set array = (`ispell -l -p $HOME/memory.txt < $1`)

set correct = ""
set incorrect = ""

foreach word ( $array )
  echo $word is mispelled. Press "enter" to keep this spelling, or type a correction
  set correction=$<
  if($correction == "") then
     echo $word >> "$HOME/memory.txt"
  else
     set correct = ( $correct $correction )
     set incorrect = ( $incorrect $word  )
  endif
end

echo "MISPELLED"'-'"CORRECTIONS"
@ counter = 1
foreach $word ( $correct )
  echo $incorrect[$counter]        $correct[$counter]
   @ counter++
end


PLEASE HELP ME!!!

Last edited by Yogesh Sawant; 05-13-2008 at 10:12 AM.. Reason: added code tags
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

New to this, pleas help...

hello, i'm totally new to this, just trying to start learing unix. I have 2 questions really... First, What's the difference between Linux and Unix? Second, Where can I find/buy the Unix os? I appriciate anyone that can help me :) (3 Replies)
Discussion started by: Sear999
3 Replies

2. UNIX for Dummies Questions & Answers

unix driving me crazy

:( :confused: what is performed by the following unix command: grep -v Jane project1.txt and grep ' 5\..' janet.txt (1 Reply)
Discussion started by: Tendernisin
1 Replies

3. Shell Programming and Scripting

PERL cgi script... extra character driving me crazy

I'm using a PERL cgi script that uses rrdtool to make graphs. I can't get the syntax correct to use a degree sign (alt+0176 like this °) and also using a variable. If I use single quotes, I can't call the variable. If I use double quotes, there is an extra symbol (Â) before the ° which goes... (2 Replies)
Discussion started by: audiophile
2 Replies

4. Shell Programming and Scripting

Escape Characters are driving me crazy!

Hi everyone, Is there anywhere I can find a complete table of all characters that must be escaped by the various UNIX shells and scripting languages? It seems every command/shell/scripting language has different rules about what characters must be escaped. I do a lot of searching and... (3 Replies)
Discussion started by: troym72
3 Replies

5. Shell Programming and Scripting

Finger has gone crazy

Two things : On the first place i am really desperate, on the second i am about to throw my laptop away to the recycle bin in a while. Ok now that i expressed my feeling let me describe you this mad situation. Code: print $1; ("finger -m " $1 "| head -1") | getline userinfo print... (6 Replies)
Discussion started by: beatblaster666
6 Replies

6. UNIX for Dummies Questions & Answers

Variable with @ sign is driving me crazy

Ok so I am working on a command that is going to do a Dig @ a certain IP address which is enclosed in a variable. Now I thought I had this figure out because it works. The problem is that it does not ALWAYS work. the variable is IP=192.168.1.1 the commands I have tried are dig... (2 Replies)
Discussion started by: MrEddy
2 Replies

7. Homework & Coursework Questions

Crazy Dots

Use and complete the template provided. The entire template must be completed. If you don't, your post may be deleted! 1. The problem statement, all variables and given/known data: Create a script called DOTS that will display the horizontal or vertical number of dots if the first argument... (3 Replies)
Discussion started by: pchelpmtl
3 Replies

8. What is on Your Mind?

Here's To The Crazy One

Please excuse my indulgence. Thank you MG Siegler and Steve Jurvetson. But most importantly, thank you Steve Jobs. 8rwsuXHA7RA The world has lost a genius. (1 Reply)
Discussion started by: Scott
1 Replies

9. UNIX for Dummies Questions & Answers

UNIX/Linux/Distributions - driving me crazy...

Hello there, first of all: I do not want to become a hacker. you cannot do that. you cannot learn that from a book. Don't think I'm some kind of a script-kiddie. now that's settled let's start. I've been trying around with a lot of OS lately. I have backtrack5 installed on my notebook,... (10 Replies)
Discussion started by: Dr. Nick
10 Replies
shift(1)							   User Commands							  shift(1)

NAME
shift - shell built-in function to traverse either a shell's argument list or a list of field-separated words SYNOPSIS
sh shift [n] csh shift [variable] ksh * shift [n] DESCRIPTION
sh The positional parameters from $n+1 ... are renamed $1 ... . If n is not given, it is assumed to be 1. csh The components of argv, or variable, if supplied, are shifted to the left, discarding the first component. It is an error for the variable not to be set or to have a null value. ksh The positional parameters from $n+1 $n+1 ... are renamed $1 ..., default n is 1. The parameter n can be any arithmetic expression that evaluates to a non-negative number less than or equal to $#. On this man page, ksh(1) commands that are preceded by one or two * (asterisks) are treated specially in the following ways: 1. Variable assignment lists preceding the command remain in effect when the command completes. 2. I/O redirections are processed after variable assignments. 3. Errors cause a script that contains them to abort. 4. Words, following a command preceded by ** that are in the format of a variable assignment, are expanded with the same rules as a vari- able assignment. This means that tilde substitution is performed after the = sign and word splitting and file name generation are not performed. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |Availability |SUNWcsu | +-----------------------------+-----------------------------+ SEE ALSO
csh(1), ksh(1), sh(1), attributes(5) SunOS 5.10 15 Apr 1994 shift(1)
All times are GMT -4. The time now is 01:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy