Sponsored Content
Top Forums Shell Programming and Scripting How to count the number of occurrence of words from multiple files? Post 302651625 by Misa-Misa on Wednesday 6th of June 2012 01:28:13 AM
Old 06-06-2012
Question How to count the number of occurrence of words from multiple files?

File 1

aaa
bbb
ccc

File 2

aaa
xxx
zzz
bbb

File 3

aaa
bbb
xxx

Output:

aaa 3
bbb 3
ccc 1
xxx 2
zzz 1

Thanks~
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Count the number of words in some subset of file and disregard others

Hi All, I have some 6000 text files in a directory. My files are named like 1.txt, 2.txt 3.txt and so on until 6000.txt. I want to count the "number of words" in only first 3000 of them. Any suggestions? I know wc -w can count the number of words in a text file. I am using Red Hat Linux. (3 Replies)
Discussion started by: shoaibjameel123
3 Replies

2. Shell Programming and Scripting

Count number of match words

Input: some random text SELECT TABLE1 some more random text some random text SELECT TABLE2 some more random text some random text SELECT TABLE3 some more random text some random text SELECT TABLE1 some more random text Output: 'SELECT TABLE1' 2 'SELECT TABLE2' 1 'SELECT TABLE3' 1 I... (5 Replies)
Discussion started by: chitech
5 Replies

3. Shell Programming and Scripting

Count number of occurrence at each line

Hi I have the following file ENST001 ENST002 4 4 4 88 9 9 ENST004 3 3 3 99 8 8 ENST009 ENST010 ENST006 8 8 8 77 8 8 Basically I want to count how many times ENST* is repeated in each line so the expected results is 2 1 3 Any suggestion please ? (4 Replies)
Discussion started by: fuad_
4 Replies

4. Shell Programming and Scripting

Count number of occurrence of a string in file

if there's a file containing: money king money queen money cat money also money king all those strings are on one line in the file. how can i find out how many times "money king" shows up in the line? egrep -c "money king" wont work. (7 Replies)
Discussion started by: SkySmart
7 Replies

5. Shell Programming and Scripting

How to count the occurrence of a number?

Hi, I have a file which contained a set of numbers like Col1 col2 col3 col4 1 sa 13 0 2 sb 14 0 3 sc 15 9 4 sd 16 -9 5 sd 20 -2 6 sd 20 4 Here in last column I need to count the zeros, positive values and negative values, please help me to do that. (2 Replies)
Discussion started by: Shenbaga.d
2 Replies

6. Shell Programming and Scripting

How to count words number for each paragraph?

Hi, I have file like this: >number1 dlejreoreltedgerere dgtrtryr >number2 dkfdjlgdjfeiflefjdfidlfjdifelfjefe fjdlfjdkfjdlfdjlfdjlfjdigeo gjelreoureofouererg >number4 dklfdjfoeueoruer fjeorueotueoirueorueorueore gjoeoueorueoreuroerueor joeuroerueorue How can i know how many words... (4 Replies)
Discussion started by: the_simpsons
4 Replies

7. Shell Programming and Scripting

Count the number of occurances for multiple files

I have some text files as shown below. I would like to add the values of each string. Your help would be appreciated!! file1.txt SUS 2 PRS 2 ALI 1 PRS 1 GLK 2 file2.txt PRS 3 GLK 6 SUS 18 Desired output SUS 20 PRS 6 (2 Replies)
Discussion started by: arch
2 Replies

8. Shell Programming and Scripting

problem to count number of words from file

hi every one i have written this simple shell for counting number of word that user need to find from file but i have get several error when run it. can someone tell me the problem ? echo "Enter the file name" read file echo "enter word" read word for i in \`cat $file` do if then... (1 Reply)
Discussion started by: nimafire
1 Replies

9. Shell Programming and Scripting

How count the number of two words associated with the two words occurring in the file?

Hi , I need to count the number of errors associated with the two words occurring in the file. It's about counting the occurrences of the word "error" for where is the word "index.js". As such the command should look like. Please kindly help. I was trying: grep "error" log.txt | wc -l (1 Reply)
Discussion started by: jmarx
1 Replies

10. Programming

awk to count occurrence of strings and loop for multiple columns

Hi all, If i would like to process a file input as below: col1 col2 col3 ...col100 1 A C E A ... 3 D E G A 5 T T A A 6 D C A G how can i perform a for loop to count the occurences of letters in each column? (just like uniq -c ) in every column. on top of that, i would also like... (8 Replies)
Discussion started by: iling14
8 Replies
NUACLGEN(8)															       NUACLGEN(8)

NAME
nuaclgen - NUFW acl generator SYNOPSIS
nuaclgen [ --Schema eq|ineq ] [ --Aclname ACLDN ] [ --saddr NETWORK1 ] [ --daddr NETWORK2 ] [ --proto PROTONUMBER ] [ --sport P1[:P2] ] [ --dport P3[:P4] ] [ --OsName OSNAME ] [ --OsVersion OSVERSION ] [ --OsRelease OSRELEASE ] [ --AppName APPLICATION NAME ] [ --AppSig APPLI- CATION SIGNATURE ] [ --Separator SEPARATOR ] [ --jump [ACCEPT|DROP] ] [ --groups GROUPLIST ] nuaclgen [ --List ] [ --groups Id Group ] nuaclgen [ --Delete DN ] nuaclgen [ --help ] DESCRIPTION
This manual page documents the nuaclgen command. nuaclgen is an Access control list generator for the ldap backend of Nuauth, the authentication server of the NUFW package. Original packaging and informations and help can be found from http://www.nufw.org/ OPTIONS
--Schema eq|ineq Use equality schema or not (Equality schema requires dport be specified, and is the default. --AclName Acl DN Add an acl in the ldap tree with dn Acl DN --saddr Network Specify source network for the acl, with network of the form : aaa.bbb.ccc.ddd[/ee]. Default value : 0.0.0.0/0 --daddr Network Specify destination network for the acl, with network of the form : aaa.bbb.ccc.ddd[/ee]. Default value : 0.0.0.0/0 --proto Protocol number Specify protocol type for the acl --sport Source port Specify source port(s) for the Acl. NNNN:MMMM can be used to specify a port range. --dport Destination port Specify destination port(s) for the Acl. NNNN:MMMM can be used to specify a port range. --jump Decision Specify decision for the Acl. Has to be ACCEPT or DROP. --groups Groups list Specify the user group(s) on which Acl apply. Must be of the form : Group1[,Group2[,...]] --List --group Group ID List Acls for the Group ID group --Delete Dn Deletes the Acl stored in the provided Dn --help Displays a brief resume of available options and quits SEE ALSO
nufw(8) nuauth(8) AUTHOR
Nuauth was designed and coded by Eric Leblond, aka Regit (<eric@regit.org>) , and Vincent Deffontaines, aka gryzor (<vincent@gryzor.com>). Original idea in 2001, while working on NSM Ldap support. This manual page was written by Eric Leblond and copyrighted by INL (2003-2005) Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 2 as published by the Free Software Foundation; with no Invariant Sections, no Front-Cover Texts and no Back-Cover Texts. 12 mars 2007 NUACLGEN(8)
All times are GMT -4. The time now is 08:16 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy