Sponsored Content
Top Forums UNIX for Dummies Questions & Answers how to count number of times each word exist in a file Post 302579833 by shnkool on Tuesday 6th of December 2011 07:07:53 PM
Old 12-06-2011
counting not correct yet

that helps a lot
but when I run it on a big file, it repeats the word
like if I have the words
bad, bad. bad: bad,
it will show
2 bad,
1 bad.
1 bad:
I only want to count the word itself so I have to delete punctuation to get it right I guess
by the way what is /12 stand for???

Quote:
Originally Posted by hergp
Try
Code:
 tr ' ' '\12' <inputfile| sort | uniq -c | sort -nr

The output looks like
Code:
      3 word
      3 that
      3 I
      3 a
      2 today
      2 to
      2 this
      2 in
      2 for
      1 write,
      1 with
      1 will
...

---------- Post updated at 06:03 PM ---------- Previous update was at 05:59 PM ----------

---------- Post updated at 06:07 PM ---------- Previous update was at 06:03 PM ----------

I couldn't implement this on what I've
I don't understand the logic behind this code
which I don't know where to add the file that I'm suppose to count the words in it

Smilie

Quote:
Originally Posted by tarun_agrawal
echo "1 2 3 3 2 1" | xargs -n 1 | awk '{a[$0]++} END{for(i in a) {print i , a[i]} }'
 

10 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

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

3. Shell Programming and Scripting

Count number of digits in a word

Hi all Can anybody suggest me, how to get the count of digits in a word I tried WORD=abcd1234 echo $WORD | grep -oE ] | wc -l 4 It works in bash command line, but not in scripts :mad: (12 Replies)
Discussion started by: ./hari.sh
12 Replies

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

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

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

7. Shell Programming and Scripting

Match and count the number of times

ile1 Beckham Ronaldo file2 Beckham Beckham_human Ronaldo Ronaldo_spain Ronaldo Ronaldo_brazil Beckham Beckham_manch Zidane Zidane_Fran Rooney Rooney_Eng Output shud be (1 Reply)
Discussion started by: cdfd123
1 Replies

8. UNIX for Dummies Questions & Answers

[Solved] Count amount of times of appearing of character before a word?

Hello Is there a way to calculate how many times a particular symbol appeared in a string before a particular word. Desktop/Myfiles/pet/dog/puppy So, I want to count number of occurence of"/" in this directory before the word dog lets say. Cheers, Bob (3 Replies)
Discussion started by: FUTURE_EINSTEIN
3 Replies

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

10. 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
CDF(3pm)						User Contributed Perl Documentation						  CDF(3pm)

NAME
PDL::GSL::CDF - PDL interface to GSL Cumulative Distribution Functions DESCRIPTION
This is an interface to the Cumulative Distribution Function package present in the GNU Scientific Library. SYNOPSIS
use PDL; use PDL::GSL::CDF; my $p = gsl_cdf_tdist_P( $t, $df ); my $t = gsl_cdf_tdist_Pinv( $p, $df ); FUNCTIONS
gsl_cdf_ugaussian_P Signature: (double x(); [o]out()) gsl_cdf_ugaussian_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_ugaussian_Pinv Signature: (double p(); [o]out()) gsl_cdf_ugaussian_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_gaussian_P Signature: (double x(); double sigma(); [o]out()) gsl_cdf_gaussian_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_gaussian_Pinv Signature: (double p(); double sigma(); [o]out()) gsl_cdf_gaussian_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_gamma_P Signature: (double x(); double a(); double b(); [o]out()) gsl_cdf_gamma_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_gamma_Pinv Signature: (double p(); double a(); double b(); [o]out()) gsl_cdf_gamma_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_cauchy_P Signature: (double x(); double a(); [o]out()) gsl_cdf_cauchy_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_cauchy_Pinv Signature: (double p(); double a(); [o]out()) gsl_cdf_cauchy_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_laplace_P Signature: (double x(); double a(); [o]out()) gsl_cdf_laplace_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_laplace_Pinv Signature: (double p(); double a(); [o]out()) gsl_cdf_laplace_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_rayleigh_P Signature: (double x(); double sigma(); [o]out()) gsl_cdf_rayleigh_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_rayleigh_Pinv Signature: (double p(); double sigma(); [o]out()) gsl_cdf_rayleigh_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_chisq_P Signature: (double x(); double nu(); [o]out()) gsl_cdf_chisq_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_chisq_Pinv Signature: (double p(); double nu(); [o]out()) gsl_cdf_chisq_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_exponential_P Signature: (double x(); double mu(); [o]out()) gsl_cdf_exponential_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_exponential_Pinv Signature: (double p(); double mu(); [o]out()) gsl_cdf_exponential_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_exppow_P Signature: (double x(); double a(); double b(); [o]out()) gsl_cdf_exppow_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_tdist_P Signature: (double x(); double nu(); [o]out()) gsl_cdf_tdist_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_tdist_Pinv Signature: (double p(); double nu(); [o]out()) gsl_cdf_tdist_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_fdist_P Signature: (double x(); double nua(); double nub(); [o]out()) gsl_cdf_fdist_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_fdist_Pinv Signature: (double p(); double nua(); double nub(); [o]out()) gsl_cdf_fdist_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_beta_P Signature: (double x(); double a(); double b(); [o]out()) gsl_cdf_beta_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_beta_Pinv Signature: (double p(); double a(); double b(); [o]out()) gsl_cdf_beta_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_flat_P Signature: (double x(); double a(); double b(); [o]out()) gsl_cdf_flat_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_flat_Pinv Signature: (double p(); double a(); double b(); [o]out()) gsl_cdf_flat_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_lognormal_P Signature: (double x(); double zeta(); double sigma(); [o]out()) gsl_cdf_lognormal_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_lognormal_Pinv Signature: (double p(); double zeta(); double sigma(); [o]out()) gsl_cdf_lognormal_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_gumbel1_P Signature: (double x(); double a(); double b(); [o]out()) gsl_cdf_gumbel1_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_gumbel1_Pinv Signature: (double p(); double a(); double b(); [o]out()) gsl_cdf_gumbel1_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_gumbel2_P Signature: (double x(); double a(); double b(); [o]out()) gsl_cdf_gumbel2_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_gumbel2_Pinv Signature: (double p(); double a(); double b(); [o]out()) gsl_cdf_gumbel2_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_weibull_P Signature: (double x(); double a(); double b(); [o]out()) gsl_cdf_weibull_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_weibull_Pinv Signature: (double p(); double a(); double b(); [o]out()) gsl_cdf_weibull_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_pareto_P Signature: (double x(); double a(); double b(); [o]out()) gsl_cdf_pareto_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_pareto_Pinv Signature: (double p(); double a(); double b(); [o]out()) gsl_cdf_pareto_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_logistic_P Signature: (double x(); double a(); [o]out()) gsl_cdf_logistic_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_logistic_Pinv Signature: (double p(); double a(); [o]out()) gsl_cdf_logistic_Pinv does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_binomial_P Signature: (ushort k(); double p(); ushort n(); [o]out()) gsl_cdf_binomial_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_poisson_P Signature: (ushort k(); double mu(); [o]out()) gsl_cdf_poisson_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_geometric_P Signature: (ushort k(); double p(); [o]out()) gsl_cdf_geometric_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_negative_binomial_P Signature: (ushort k(); double p(); double n(); [o]out()) gsl_cdf_negative_binomial_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_pascal_P Signature: (ushort k(); double p(); ushort n(); [o]out()) gsl_cdf_pascal_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. gsl_cdf_hypergeometric_P Signature: (ushort k(); ushort na(); ushort nb(); ushort t(); [o]out()) gsl_cdf_hypergeometric_P does handle bad values. It will set the bad-value flag of all output piddles if the flag is set for any of the input piddles. AUTHOR
Copyright (C) 2009 Maggie J. Xiong <maggiexyz users.sourceforge.net> The GSL CDF module was written by J. Stover. All rights reserved. There is no warranty. You are allowed to redistribute this software / documentation as described in the file COPYING in the PDL distribution. perl v5.14.2 2012-06-04 CDF(3pm)
All times are GMT -4. The time now is 03:02 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy