Sponsored Content
Full Discussion: question about wc
Top Forums Shell Programming and Scripting question about wc Post 302072824 by yodadbl07 on Monday 8th of May 2006 03:19:22 AM
Old 05-08-2006
question about wc

Hey my friend was asking me if i knew a way to cout how many different words in a file. I told him no not off hand, but i was thinking about it, and i started to wonder also. I imagine this is probably pretty simple im just missing something, I keep confusing my self with how you would compair and filter out the same words twice or more. If any one knows of a way to do this id like to know.....

thanks
 

7 More Discussions You Might Find Interesting

1. Programming

Yet Another Question

Now that I have getch() to work, I have yet another problem. BTW, thank you for answering these questions, I do ask a lot, only because I am eager to know, what is a board used for anyways :) Ok, he's the problem... #include iostream.h #include conio.h int main() { char movement; ... (2 Replies)
Discussion started by: mbolthouse
2 Replies

2. Programming

Question?

what is WDFP and WE STATION? (1 Reply)
Discussion started by: billybayou
1 Replies

3. Solaris

vi question

Im trying to edit a 113 meg file in VI and i get the error TMP FILE TOO LARGE. Does someone know how to get around this? Thanks! (1 Reply)
Discussion started by: BG_JrAdmin
1 Replies

4. UNIX for Dummies Questions & Answers

mv question

Hello if I like to move file from defined directories system to new directory that not contained any directories system structure . But I like to create the same file system structure as source directory for example : I have 2 directories: foo1 and foo2 foo1 have directories and foo2 have... (2 Replies)
Discussion started by: umen
2 Replies

5. UNIX for Dummies Questions & Answers

Question

hallo, ik heb hier een vraagje. hoeveel gebruikers kunnen er op 1 unix systeem. hopelijk antwoorden golle nu want ik moet da vinde voor school en die leerkracht zaagt. :p groetjes eu wacht wa was mijne nick ah ja vraagje groetjes vraagje ik kan geen engels dus antwoord liever in het... (1 Reply)
Discussion started by: vraagje
1 Replies

6. Hardware

question

How to add 3 moniters to a pc set up? (2 Replies)
Discussion started by: clicstic
2 Replies

7. AIX

df question

Hi, Can anyone please explain a little about df command. I have following question: Following example is showing % used as 4 where as total free blocks are 15.46 out of 16.00 MB blocks. df -m /test Filesystem MBblocks Free %Used Iused %Iused ... (5 Replies)
Discussion started by: itsabhi9
5 Replies
FBB::binary_search(3bobcat)				      Binary search function				       FBB::binary_search(3bobcat)

NAME
FBB::binary_search - Extensions to the STL binary_search function template SYNOPSIS
#include <bobcat/binarysearch> DESCRIPTION
The FBB::binary_search function templates extend the STL binary_search function template returning an iterator to the element found, instead of a bool value informing the caller whether or not the searched for element is present in a provided iterator range. The bool value returned by the STL binary_search function template is often not the kind of information the caller of the function is interested in. Rather, the caller will often want to use binary_search in the way find_if is used: returning an iterator to the found ele- ment or returning the end-iterator if the element was not found. Whereas find_if does not require the elements in the iterator range to be sorted, and thus will use a linear search binary_search may use the sorted nature of the elements to its advantage, using a binary search algorithm requiring 2 log N iterations to locate the searched for element rather than (on average) N/2 iterations. The FBB::binary_search algorithm uses this binary searching process while at the same time allowing its use like find_if. Since the FBB::binary_search function templates use the same number and types of parameters as the stl::binary_search function templates the explicit use of the FBB namespace will often be required in situations where both function templates are made available to the com- piler. NAMESPACE
FBB All constructors, members, operators and manipulators, mentioned in this man-page, are defined in the namespace FBB. INHERITS FROM
- OVERLOADED FUNCTIONS
In the following description several template type parameters are used. They are: o Iterator represents an iterator type; o Type represents a value of the type to which Iterator points. o Comparator represents a comparator function or class type object which was used to sort the elements to which the Iterator range refer; o Iterator binary_search(Iterator begin, Iterator end, Type const &value): Using a binary search algorithm value is searched for in the range of elements referred to by the provided iterator range. If the value is found an iterator pointing to this value is returned, otherwise end is returned. The elements in the range must have been sorted by the Type::operator<() function. o Iterator binary_search(Iterator begin, Iterator end, Type const &value, Comparator comparator): Using a binary search algorithm value is searched for in the range of elements referred to by the provided iterator range. If the value is found an iterator pointing to this value is returned, otherwise end is returned. The elements and the provided value are compared using comparator(*iterator, value) calls, where *iterator refers to an object in the provided iterator range. The elements in the range must have been sorted by the Comparator function or function object. EXAMPLES
#include <iostream> #include <string> #include "../binarysearch" using namespace std; using namespace FBB; string words[] = { "eight", // alphabetically sorted number-names "five", "four", "nine", "one", "seven", "six", "ten", "three", "two" }; class Comparator { public: bool operator()(string const &left, string const &right) const; }; inline bool Comparator::operator()(string const &left, string const &right) const { return left < right; } bool compFun(string const &left, string const &right) { return left < right; } int main() { string *ret = binary_search(words, words + 10, "five"); if (ret != words + 10) cout << "five is at offset " << (ret - words) << endl; ret = binary_search(words, words + 10, "grandpa"); if (ret == words + 10) cout << "grandpa is not the name of a number "; ret = binary_search(words, words + 10, "five", Comparator()); if (ret != words + 10) cout << "five is at offset " << (ret - words) << endl; ret = binary_search(words, words + 10, "grandpa", compFun); // or use: Comparator() if (ret == words + 10) cout << "grandpa is not the name of a number "; return 0; } FILES
bobcat/binarysearch - defines the template functions SEE ALSO
bobcat(7) BUGS
None reported. DISTRIBUTION FILES
o bobcat_3.01.00-x.dsc: detached signature; o bobcat_3.01.00-x.tar.gz: source archive; o bobcat_3.01.00-x_i386.changes: change log; o libbobcat1_3.01.00-x_*.deb: debian package holding the libraries; o libbobcat1-dev_3.01.00-x_*.deb: debian package holding the libraries, headers and manual pages; o http://sourceforge.net/projects/bobcat: public archive location; BOBCAT
Bobcat is an acronym of `Brokken's Own Base Classes And Templates'. COPYRIGHT
This is free software, distributed under the terms of the GNU General Public License (GPL). AUTHOR
Frank B. Brokken (f.b.brokken@rug.nl). libbobcat1-dev_3.01.00-x.tar.gz 2005-2012 FBB::binary_search(3bobcat)
All times are GMT -4. The time now is 03:29 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy