11-21-2002
scripting - write a script that will count the number of times a particular word
hello everyone,
I'm trying to learn some scripts but i cant get my head around two of them.
1. how can i write a script that will count the number of times a particular word is used in file?
2. how can i make a script that will take me to a web page from unix?
if anyone could help it would be appreciated very much.
10 More Discussions You Might Find Interesting
1. Shell Programming and Scripting
Hi Folks !!!!!!!!!!!!!!!!!!!
My Requirement is.............
i have a input file:
501,501.chan
502,502.anand
503,503.biji
504,504.raja
505,505.chan
506,506.anand
507,507.chan
and my o/p should be
chan->3
i.e. the word which occurs maximum number of times in a file should be... (5 Replies)
Discussion started by: aajan
5 Replies
2. Shell Programming and Scripting
I've been looking on the internet, and haven't found anything simple enough to use in my code. All I want to do is count how many times "-" occurs in a string of characters (as a package name). It seems it should be very simple, and shouldn't require more than one line to accomplish.
And this is... (2 Replies)
Discussion started by: Shingoshi
2 Replies
3. Shell Programming and Scripting
guys,
I am new shelll scripting..
this a question on passt exam paper, I was trying to solve it , I can not.
the question is as follow?
a. Write a shell script to count the number of accounts which belong to particular primary group in a standard UNIX system which uses local... (1 Reply)
Discussion started by: gurmad
1 Replies
4. Shell Programming and Scripting
Hi All,
I wanted to know if there is a shell command to print a word n number of times
The Input File is :
Cat 4
Bat 3
Zall 1
Kite 2
Output File required is :
Cat
Cat
Cat
Cat
Bat
Bat
Bat
Zall
Kite (4 Replies)
Discussion started by: sam_2921
4 Replies
5. Shell Programming and Scripting
ile1
Beckham
Ronaldo
file2
Beckham Beckham_human
Ronaldo Ronaldo_spain
Ronaldo Ronaldo_brazil
Beckham Beckham_manch
Zidane Zidane_Fran
Rooney Rooney_Eng
Output shud be (1 Reply)
Discussion started by: cdfd123
1 Replies
6. Shell Programming and Scripting
Hi Experts,
I want to know the count of specific word in a file. I have almost 600+ files.
So I want to loop thru each file and get the count of the specific word.
Please help me on achieving this...
Many thanks (2 Replies)
Discussion started by: elamurugu
2 Replies
7. UNIX for Dummies Questions & Answers
I'm trying to count the number of times each word in the file exist
for example if the file has:
today I have a lot to write, but I will not go for it. The main thing is that today I am looking for a way to get each word in this file with a word count after it specifying that this word has... (4 Replies)
Discussion started by: shnkool
4 Replies
8. UNIX for Dummies Questions & Answers
Hello Is there a way to calculate how many times a particular symbol appeared in a string before a particular word.
Desktop/Myfiles/pet/dog/puppy
So, I want to count number of occurence of"/" in this directory before the word dog lets say.
Cheers,
Bob (3 Replies)
Discussion started by: FUTURE_EINSTEIN
3 Replies
9. UNIX for Dummies Questions & Answers
Hi
Please can you help how do I count the number of specific characters or words that appear in a file? (8 Replies)
Discussion started by: fretagi
8 Replies
10. Shell Programming and Scripting
can i get a simple script for , Count same word which has come many times in single lines & pars
Eg file would be ==
"Thanks heman thanks thanks
Thanks heman
thanks man"
So resullt should be
Thanks = 5
heman=2
man = 1
thanks in advance :)
Please use code tags for code and... (1 Reply)
Discussion started by: heman96
1 Replies
LEARN(1) General Commands Manual LEARN(1)
NAME
learn - computer aided instruction about UNIX
SYNOPSIS
learn [ -directory ] [ subject [ lesson ] ]
DESCRIPTION
Learn gives Computer Aided Instruction courses and practice in the use of UNIX, the C Shell, and the Berkeley text editors. To get started
simply type learn. If you had used learn before and left your last session without completing a subject, the program will use information
in $HOME/.learnrc to start you up in the same place you left off. Your first time through, learn will ask questions to find out what you
want to do. Some questions may be bypassed by naming a subject, and more yet by naming a lesson. You may enter the lesson as a number
that learn gave you in a previous session. If you do not know the lesson number, you may enter the lesson as a word, and learn will look
for the first lesson containing it. If the lesson is `-', learn prompts for each lesson; this is useful for debugging.
The subject's presently handled are
files
editor
vi
morefiles
macros
eqn
C
There are a few special commands. The command `bye' terminates a learn session and `where' tells you of your progress, with `where m'
telling you more. The command `again' re-displays the text of the lesson and `again lesson' lets you review lesson. There is no way for
learn to tell you the answers it expects in English, however, the command `hint' prints the last part of the lesson script used to evaluate
a response, while `hint m' prints the whole lesson script. This is useful for debugging lessons and might possibly give you an idea about
what it expects.
The -directory option allows one to exercise a script in a nonstandard place.
FILES
/usr/share/learn subtree for all dependent directories and files
/usr/tmp/pl* playpen directories
$HOME/.learnrc startup information
SEE ALSO
csh(1), ex(1)
B. W. Kernighan and M. E. Lesk, LEARN - Computer-Aided Instruction on UNIX
BUGS
The main strength of learn, that it asks the student to use the real UNIX, also makes possible baffling mistakes. It is helpful, espe-
cially for nonprogrammers, to have a UNIX initiate near at hand during the first sessions.
Occasionally lessons are incorrect, sometimes because the local version of a command operates in a non-standard way. Occasionally a lesson
script does not recognize all the different correct responses, in which case the `hint' command may be useful. Such lessons may be skipped
with the `skip' command, but it takes some sophistication to recognize the situation.
To find a lesson given as a word, learn does a simple fgrep(1) through the lessons. It is unclear whether this sort of subject indexing is
better than none.
Spawning a new shell is required for each of many user and internal functions.
The `vi' lessons are provided separately from the others. To use them see your system administrator.
7th Edition October 22, 1996 LEARN(1)