Sponsored Content
Top Forums UNIX for Dummies Questions & Answers search& count for the occurence of a word Post 302144764 by skoppana on Friday 9th of November 2007 03:40:35 PM
Old 11-09-2007
search& count for the occurence of a word

Greetings,
I need to search and count all the occurences of a word in all the files in a directory.
Any suggestions greatly appreciated.

Thanks
 

9 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Count the number of occurence of perticular word from file

I want to count the number of occurence of perticular word from one text file. Please tell me "less" command is work in ksh or not. If it is not working then instead of that which command will work. :confused: (40 Replies)
Discussion started by: rinku
40 Replies

2. Shell Programming and Scripting

Delete all occurence of a word in one shot

i have a file called file1 cat file1 i am namish namish lives in India India and namish both are good. I want to delete all the occurences of namish in one shot,if i do it with sed i guess all the lines will be deleted containing the pattern.Suggest me any idea without AWK. Thanks... (6 Replies)
Discussion started by: namishtiwari
6 Replies

3. UNIX for Advanced & Expert Users

How to count the occurence of a character in a line

Suppose i have data like :- 1,2,3,4,5 a,b,c x,y,z,t I want to count the occurence of , (comma) in every line. Waiting for a solution.:) (1 Reply)
Discussion started by: sumit207
1 Replies

4. UNIX for Dummies Questions & Answers

How to count the occurence of a character in a line

Suppose i have data like :- 1,2,3,4,5 a,b,c x,y,z,t I want to count the occurence of , (comma) in every line. Waiting for a solution. (5 Replies)
Discussion started by: sumit207
5 Replies

5. Shell Programming and Scripting

finding the number of occurence of a word in a line

suppose i have this line abs|der|gt|dftnrk|dtre i want to count the number of "|" in this line.. how can i do that. plz help:confused: (9 Replies)
Discussion started by: priyanka3006
9 Replies

6. UNIX for Dummies Questions & Answers

counting the occurence of a word

In a file I have to count a particular word. like i need apache how many times. I tried this $ tr "\011" "\012\012"<foo1 | tr -cd "" |sort\uniq -c but I got result like this 32 apache 18 dns 12 doctor Please sugest me (4 Replies)
Discussion started by: pranabrana
4 Replies

7. Shell Programming and Scripting

Perl : Search for next occurence of a word in an array

I have an array as follows: Space: ABC Name: def Age: 22 Type: new Name: fgh Age: 34 Type: old Space: XYZ Name: pqr Age: 44 Type: new : : How can I separate the array with elements starting from Space:ABC until Space: XYZ & put them in a different array & so on... (4 Replies)
Discussion started by: deo_kaustubh
4 Replies

8. Shell Programming and Scripting

Count same word which has come many times in single lines & pars

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

9. Programming

Python Count Number Of Occurence

Hello, I have a programming assignment to count number of occurrences of hours in particular file. Below is the code: fname = raw_input("Enter file name: ") if len(fname) < 1 : fname = "mbox-short.txt" largest = None fh = open(fname) counts = dict() test = list() for line in fh: ... (2 Replies)
Discussion started by: infinitydon
2 Replies
Hunspell(3pm)						User Contributed Perl Documentation					     Hunspell(3pm)

NAME
Text::Hunspell - Perl interface to the GNU Hunspell library SYNOPSIS
# For this example to work, you have to have # the US english dictionary installed! use strict; use warnings; use Data::Dumper (); use Text::Hunspell; # You can use relative or absolute paths. my $speller = Text::Hunspell->new( "/usr/share/hunspell/en_US.aff", # Hunspell affix file "/usr/share/hunspell/en_US.dic" # Hunspell dictionary file ); die unless $speller; # Check a word against the dictionary my $word = 'opera'; print $speller->check($word) ? "'$word' found in the dictionary " : "'$word' not found in the dictionary! "; # Spell check suggestions my $misspelled = 'programmng'; my @suggestions = $speller->suggest($misspelled); print " ", "You typed '$misspelled'. Did you mean? "; for (@suggestions) { print " - $_ "; } # Analysis of a word $word = 'automatic'; my $analysis = $speller->analyze($word); print " ", "Analysis of '$word' returns '$analysis' "; # Word stemming $word = 'development'; my @stemming = $speller->stem($word); print " ", "Stemming of '$word' returns: "; for (@stemming) { print " - $_ "; } #------------------------------------------ # ADVANCED STUFF FROM HERE # NOT SURE HOW IT SHOULD WORK #------------------------------------------ # # Test here generator for morphological modification (NOM->ACC) # $word = 'developer'; my $stem = 'computer'; @suggestions = $speller->analyze($stem); # Modify analyze output for required class (ACC) for (@suggestions) { s/NOM/ACC/g; } # Generate ACC class of stem @suggestions = $speller->generate2($stem, @suggestions); print "Morphological modification generator... "; print Data::Dumper::Dumper(@suggestions); # # Test generator for morphological modification, # modify $stem like $word # @suggestions = $speller->generate($stem, $word); print "Morphological modification generator... "; print Data::Dumper::Dumper(@suggestions); # Deletes the underlying Hunspell C/C++ object $speller->delete($speller); DESCRIPTION
This module provides a Perl interface to the OO Hunspell library. This module is to meet the need of looking up many words, one at a time, in a single session, such as spell-checking a document in memory. The example code describes the interface on http://hunspell.sf.net DEPENDENCIES
You MUST have installed GNU Hunspell library version 1.0 or higher on your system before installing this "Text::Hunspell" Perl module. Hunspell location is: http://hunspell.sf.net There have been a number of bug reports because people failed to install hunspell before installing this module. This is an interface to the hunspell library installed on your system, not a replacement for hunspell. You must also have one hunspell dictionary installed when running the module's test suite. Also, please see the README and Changes files. README may have specific information about your platform. METHODS
The following methods are available: "Text::Hunspell-"new($full_path_to_affix, $full_path_to_dic)> Creates a new speller object. Parameters are: full path of affix file full path of dictionary (dic) file Returns "undef" if the object could not be created, which is unlikely. "check($word)" Check the word. Returns 1 if the word is found, 0 otherwise. "suggest($misspelled_word)" Returns the list of suggestions for the misspelled word. "analyze($word)" Returns the analysis list for the word. TODO HOW? What does it return?? See the examples in the examples/ folder for now. "stem($word)" Returns the stem list for the word. "generate2($stem, @suggestions)" Returns a morphologically modified stem as defined in @suggestions (got by analysis). TODO Explain ... "generate($stem, $word)" Returns morphologically modified stem like $word. TODO WHY IS THIS DIFFERENT FROM generate2() ??? EXPLAIN. "$speller-"delete($speller)> Deletes the speller class. TODO WHY IS THIS NEEDED?? Called on $speller and needs $speller ??? BUGS
Probably. Yes, definitely. COPYRIGHT
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. AUTHORS
Eleonora, E<lt>eleonora46_at_gmx_dot_netE<gt> Current maintainer is: Cosimo Streppone, E<lt>cosimo@cpan.orgE<gt> This module is based on a Text::Aspell written by Bill Moseley moseley at hank dot org. Hunspell is written as myspell by Kevin B. Hendricks. Hunspell is maintained by Nemeth Laszlo. Please see: http://hunspell.sf.net For the dictionaries: http://lingucomponent.openoffice.org/spell_dic.html http://magyarispell.sf.net for Hungarian dictionary perl v5.14.2 2012-06-07 Hunspell(3pm)
All times are GMT -4. The time now is 03:49 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy