The UNIX and Linux Forums  
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.

Go Back   The UNIX and Linux Forums > Top Forums > Shell Programming and Scripting
.
google unix.com



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

Closed Thread
English Japanese Spanish French German Portuguese Italian Dutch Swedish Russian Norwegian Hungarian Hebrew Danish Powered by Powered by Google
 
LinkBack Thread Tools Search this Thread Rate Thread Display Modes
  #1 (permalink)  
Old 11-21-2002
BigTool4u2 BigTool4u2 is offline
Registered User
  
 

Join Date: Nov 2002
Location: London
Posts: 31
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.
  #2 (permalink)  
Old 11-21-2002
RTM's Avatar
RTM RTM is offline Forum Advisor  
Hog Hunter
  
 

Join Date: Apr 2002
Location: On my motorcycle
Posts: 3,039
What are you writing these scripts in? What shell?
(What OS too)

Post anything you may have started and the problems you are having.
  #3 (permalink)  
Old 06-24-2009
rakesh_pagadala rakesh_pagadala is offline
Registered User
  
 

Join Date: May 2009
Location: hyderabad
Posts: 20
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
  #4 (permalink)  
Old 06-24-2009
DukeNuke2's Avatar
DukeNuke2 DukeNuke2 is online now Forum Staff  
Soulman
  
 

Join Date: Jul 2006
Location: Germany, Berlin
Posts: 2,947
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
Closed Thread

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT -4. The time now is 08:24 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited. Language Translations Powered by .
vBCredits v1.4 Copyright ©2007 - 2008, PixelFX Studios
The UNIX and Linux Forums Content Copyright ©1993-2009. All Rights Reserved.Ad Management by RedTyger

Content Relevant URLs by vBSEO 3.2.0