I need help with a basic script


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting I need help with a basic script
# 1  
Old 12-10-2007
I need help with a basic script

a) Total number of words in the file.

b) Total number of different words in the file.

How can I use the translate and/or unique commands to accomplish this

Last edited by EECSDAVE; 12-10-2007 at 06:58 PM.. Reason: To solicit a response
# 2  
Old 12-10-2007
back in my day, we used to listen in class. then we would learn how to do our own work.

refer to item 6:

https://www.unix.com/unix-dummies-que...om-forums.html
# 3  
Old 12-10-2007
here's the original text before he edited it:

Quote:
Assume you have a file that contains text. This file can be a news article,
essay, ... that contains regular words from the English language.

Write a C-shell script that prompts the user for the name of the text file to be examined.

Output is:

a) Total number of words in the file.

b) Total number of different words in the file.

I should use the translate command
# 4  
Old 12-10-2007
Thanks for your incorrect diagnosis. I'm actually trying to teach myself scripting and this was a problem in the book that I am using to learn from. So number six does not apply to me, but I appreciate the attempted moral rebuke. LOLSmilie
# 5  
Old 12-10-2007
Quote:
Originally Posted by EECSDAVE
I'm actually trying to teach myself scripting and this was a problem in the book that I am using to learn from.
The approach we are trying to encourage is to include phrases such as ".... and this is how far I got ..." or ".... I am trying to use XXX but it's not doing what I thought it would....".

There was a story about teaching somebody to fish.......
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Need a little help with my first shell script. Basic image resize script...

Hey everyone, just now joined because I didn't want to go onto Ubuntu forums and start asking about how to write shell scripts. Seems like this is a pretty active forum for exactly what I need. I'm trying to modify a shell script I found online, the end goal is to have it find all files in the... (9 Replies)
Discussion started by: mozzles
9 Replies

2. UNIX for Dummies Questions & Answers

Help with basic script - not working..

Here is the script I wrote... Pls. help. #!/bin/ksh for SERVER in NEWSNYD403P NEWSNYD404P SNEWSNYD601P SNEWSNYD602P SNEWSDNY603P SNEWSNYD604P do /usr/bin/scp "/home/sam/bash.tar root@$SERVER":/tmp done Error msg I get: ./scp_script.sh: syntax error at line 3:... (2 Replies)
Discussion started by: samnyc
2 Replies

3. Shell Programming and Scripting

Basic shell script help

Im trying to make a script that simply adds a word to the last available line in a txt file without overwriting any previous lines. Ive googled this and there are great examples but no one explain what each function does, and i dont entirely understand how it works. Basically Im looking for... (7 Replies)
Discussion started by: kylecn
7 Replies

4. Shell Programming and Scripting

Basic script question

I'm trying to approach a problem but all I'm coming up with are complex ways to manipulate the data. But still not getting the desired outcome. directory of files.... file-100-foo file-100-man file-100-chu Need to copy the files and increment the number in the file name ... (4 Replies)
Discussion started by: suphawk
4 Replies

5. Shell Programming and Scripting

create a basic script

Hi everybody :( :confused: :D, I need someone to help me! I have a file with 4 colunms and I would like to transform only the 4th colunm by multiplying this by a constant value (i.e 0.3047). I'm a new one using/creating basic scripts and I'm using linux redhat. The file has the following... (1 Reply)
Discussion started by: Estanislau
1 Replies

6. Shell Programming and Scripting

create a basic script

Hi everybody :( :confused: :D, I need someone to help me! I have a file with 4 colunms and I would like to transform only the 4th colunm by multiplying this by a constant value (i.e 0.3047). I'm a new one using/creating basic scripts and I'm using linux redhat. The file has the following... (1 Reply)
Discussion started by: Estanislau
1 Replies

7. Shell Programming and Scripting

Basic script?

All, I have a list of over 400 users that need certain directories created. These will be created in /users/$username on a system and I need a directory called chess under these directories that I create. Instead of me manually adding each one (mkdir /users/user1, mkdir /users/user1/chess)... (1 Reply)
Discussion started by: kjbaumann
1 Replies

8. UNIX for Dummies Questions & Answers

Need help with basic unix script

What I am supposed to do is creat a menu with the following Find a song Find a album Sort by artist Delete a song Add a new song Quit Now the file with the song information is database Here is what I have so far #!/bin/bash #================================================= #Script Name:... (1 Reply)
Discussion started by: stp0052
1 Replies
Login or Register to Ask a Question