![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| Shell Programming and Scripting Post questions about KSH, CSH, SH, BASH, PERL, PHP, SED, AWK and OTHER shell scripts and shell scripting languages here. |
More UNIX and Linux Forum Topics You Might Find Helpful
|
||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Count number of occurences of a word | shikhakaul | UNIX for Dummies Questions & Answers | 8 | 06-25-2009 11:10 AM |
| Looking for a single line to count how many times one character occurs in a word... | Shingoshi | Shell Programming and Scripting | 2 | 06-12-2009 10:12 PM |
| Count number of digits in a word | ./hari.sh | Shell Programming and Scripting | 12 | 01-07-2009 10:43 PM |
| TO find the word which occurs maximum number of times | aajan | Shell Programming and Scripting | 5 | 01-11-2008 04:11 AM |
| word count showing wrong number of lines | tselvanin | UNIX for Dummies Questions & Answers | 3 | 01-06-2004 11:33 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
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. |
|
||||
|
Even i am very new to scripting so i am not very sure of some advance regular expressions. So i am giving the basic shell script
Code:
count=0 for i in $(cat location of file) do if [ $i == name ]; #name which you want to find from the given file then count=`expr $count + 1` fi done echo $count |
|
|||||
|
Homework is not permitted at The UNIX and Linux Forums.
Please read the rules, which you agreed to when you registered, if you have not already done so. More-than-likely, posting homework has resulting in a forum infraction. If you did not post homework, please explain the company you work for and the nature of the problem you are working on. Thank You. The UNIX and Linux Forums. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|