Sponsored Content
Top Forums Shell Programming and Scripting how many times a word occur in afile Post 302242797 by nua7 on Friday 3rd of October 2008 01:45:53 AM
Old 10-03-2008
MySQL

Code:
grep -w "echo" tst | wc -w

echo is the word you are looking for and tst is the file.
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

TO find the word which occurs maximum number of times

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

delete lines containing a specific word in afile

Hi, Please suggest how to write a shell script which delets all the lines containing the word unix in the files supplied as argument in the shell. (4 Replies)
Discussion started by: sireesha9
4 Replies

3. Shell Programming and Scripting

Looking for a single line to count how many times one character occurs in a word...

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

4. Shell Programming and Scripting

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... (3 Replies)
Discussion started by: BigTool4u2
3 Replies

5. Shell Programming and Scripting

Print a word specific number of times

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

6. UNIX for Dummies Questions & Answers

how to count number of times each word exist in a file

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

7. Shell Programming and Scripting

awk to find lines containing word that occur multiple times

i have a script that scans a log file every 10 minutes. this script remembers the last line of the log and then uses it to continue monitoring the log when it runs again 10 minutes later. the script searches the log for a string called MaxClients. now, how can i make it so that when the... (7 Replies)
Discussion started by: SkySmart
7 Replies

8. UNIX for Dummies Questions & Answers

How do I count how many times a specific word appear in a file (ksh)?

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

9. 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

10. Shell Programming and Scripting

Find word in a line and output in which line the word occurs / no. of times it occurred

I have a file: file.txt, which contains the following data in it. This is a file, my name is Karl, what is this process, karl is karl junior, file is a test file, file's name is file.txt My name is not Karl, my name is Karl Joey What is your name? Do you know your name and... (3 Replies)
Discussion started by: anuragpgtgerman
3 Replies
tst(3)							    InterNetNews Documentation							    tst(3)

NAME
tst - ternary search trie functions SYNOPSIS
#include <inn/tst.h> struct tst; struct tst *tst_init(int node_line_width); void tst_cleanup(struct tst *tst); int tst_insert(struct tst *tst, const unsigned char *key, void *data, int option, void **exist_ptr); void *tst_search(struct tst *tst, const unsigned char *key); void *tst_delete(struct tst *tst, const unsigned char *key); DESCRIPTION
tst_init allocates memory for members of struct tst, and allocates the first node_line_width nodes. A NULL pointer is returned by tst_init if any part of the memory allocation fails. On success, a pointer to a struct tst is returned. The value for node_line_width must be chosen very carefully. One node is required for every character in the tree. If you choose a value that is too small, your application will spend too much time calling malloc(3) and your node space will be too spread out. Too large a value is just a waste of space. tst_cleanup frees all memory allocated to nodes, internal structures, as well as tst itself. tst_insert inserts the string key into the tree. Behavior when a duplicate key is inserted is controlled by option. If key is already in the tree then TST_DUPLICATE_KEY is returned, and the data pointer for the existing key is placed in exist_ptr. If option is set to TST_REPLACE then the existing data pointer for the existing key is replaced by data. Note that the old data pointer will still be placed in exist_ptr. If a duplicate key is encountered and option is not set to TST_REPLACE then TST_DUPLICATE_KEY is returned. If key is zero length then TST_NULL_KEY is returned. A successful insert or replace returns TST_OK. A return value of TST_ERROR indicates that a memory allocation error occurred while trying to grow the node free. Note that the data argument must never be NULL. If it is, then calls to tst_search will fail for a key that exists because the data value was set to NULL, which is what tst_search returns. If you just want a simple existence tree, use the tst pointer as the data pointer. tst_search finds the string key in the tree if it exists and returns the data pointer associated with that key. If key is not found then NULL is returned, otherwise the data pointer associated with key is returned. tst_delete deletes the string key from the tree if it exists and returns the data pointer assocaited with that key. If key is not found then NULL is returned, otherwise the data pointer associated with key is returned. HISTORY
Converted to POD from Peter A. Friend's ternary search trie documentation by Alex Kiernan <alex.kiernan@thus.net> for InterNetNews 2.4.0. $Id: tst.pod 9074 2010-05-31 19:01:32Z iulius $ INN 2.5.3 2011-06-10 tst(3)
All times are GMT -4. The time now is 08:56 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy