Sponsored Content
Top Forums Shell Programming and Scripting Counting occurrences of all words in multiple files Post 302584458 by bartus11 on Friday 23rd of December 2011 09:44:39 AM
Old 12-23-2011
Try:
Code:
awk '{for (i=1;i<=NF;i++) a[tolower($i)]++}END{for (i in a) print i" "a[i]}' * | sort -nrk2

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

pattern search for multiple log files and counting

I have 10 appservers and each appserver has 4 jvms . Each of these logs is archived and stored on a nfs directory . For example the files are /logs/200907/ap1-jvm1.server.log.20090715.gz /logs/200907/ap2-jvm2.server.log.20090714.gz /logs/200908/ap1-jvm1.server.log.20090812.gz I want to... (3 Replies)
Discussion started by: gubbu
3 Replies

2. Shell Programming and Scripting

Counting words

Hi Is there a way to count the no. of words in all files in directory. All are text files.I use wc -w but somehow i am not getting the rite answer. Is there an alternative. Thanks in advance (9 Replies)
Discussion started by: kinny
9 Replies

3. Shell Programming and Scripting

Counting lines in multiple files

Hi, I have couple of .txt files (say 50 files) in a folder. For each file: I need to get the number of lines in each file and then that count -1 (I wanted to exclude the header. Then sum the counts of all files and output the total sum. Is there an efficient way to do this using shell... (7 Replies)
Discussion started by: Lucky Ali
7 Replies

4. Shell Programming and Scripting

multiple files: counting

In a directory, I have 5000 multiple files that contains around 4000 rows with 10 columns in each file containing a unique string 'AT' located at 4th column. OM 3328 O BT 268 5.800 7.500 4.700 0.000 1.400 OM 3329 O BT 723 8.500 8.900... (7 Replies)
Discussion started by: asanjuan
7 Replies

5. Shell Programming and Scripting

counting number of pattern occurrences

Hi All, Is it possible to count number of occurrences of a pattern in a single record using awk?? for example: a line like this: abrsjdfhafa I want to count the number of a character occurrences. but still use the default RS, I don't want to set RS to single character. (1 Reply)
Discussion started by: ghoda2_10
1 Replies

6. Shell Programming and Scripting

Counting number of files that contain words stored in another file

Hi All, I have written a script on this but it does not do the requisite job. My requirement is this: 1. I have two kinds of files each with different extensions. One set of files are *.dat (6000 unique DAT files all in one directory) and another set *.dic files (6000 unique DIC files in... (1 Reply)
Discussion started by: shoaibjameel123
1 Replies

7. Shell Programming and Scripting

Counting non-specific occurrences within a file.

I'm pretty new to scripting and didn't see an example of this issue yet. I am trying to count and print the total number of times each value is found within a file. Here is a short example of my starting file. value 3 value 3 value 3 value 3 value 4 value 6 value 6 value 6 value 6... (3 Replies)
Discussion started by: funkynmr
3 Replies

8. UNIX for Dummies Questions & Answers

BASH - Counting word occurrences in a Web Page

Hi all, I have to do a script bash (for university) that counts all word occurrences in a specific web page. anyone can help me?. Thanks :) (1 Reply)
Discussion started by: piacentero
1 Replies

9. UNIX for Dummies Questions & Answers

Awk: Counting occurrences between two files

Hi, I have two text files (1.txt and 2.txt). 2.txt contains two columns which are extracted from 1.txt using a simple if(condition) print. I want to: - count how many times the values contained in 2.txt appear in 1.txt -if they appear just one time, I have to delete the entire row in... (5 Replies)
Discussion started by: Pintug
5 Replies

10. Shell Programming and Scripting

sed parser behaving strange on replacing multiple words in multiple files

I have 4000 files like $cat clus_grp_seq10_g.phy 18 1002 anig_OJJ65951_1 ATGGTTTCGCAGCGTGATAGAGAATTGTTTAGGGATGATATTCGCTCGCGAGGAACGAAGCTCAATGCTGCCGAGCGCGAGAGTCTGCTAAGGCCATATCTGCCAGATCCGTCTGACCTTCCACGCAGGCCACTTCAGCGGCGCAAGAAGGTTCCTCG aver_OOF92921_1 ... (1 Reply)
Discussion started by: sammy777888
1 Replies
auditmask(8)						      System Manager's Manual						      auditmask(8)

Name
       auditmask - get or set auditmasks

Syntax
       auditmask [ option ...  ] [ event[:succeed:fail]

Description
       The  command  with  no  arguments displays the system-calls and trusted-events currently being audited for the system, and displays whether
       they are being audited under successful or failed occurrences or both.  The format used for the display is acceptable as input to the  com-
       mand.

       The command with event arguments sets the system-call and trusted-event audit masks for the system.  This is cumulative operation, so it is
       possible to turn on or off audit for one set of events, then turn on or off audit for a second set of events without changing the first set
       of  events (except for intersection between the two sets).  Command line arguments to can include one or more events, each with an optional
       field :succeed:fail, where succeed is either 0 to specify no auditing of successful occurrences of event, or 1 (or any non-zero	character)
       to specify auditing of successful occurrences of event; and fail is either 0 to specify no auditing of failed occurrences of event or 1 (or
       any non-zero character) to specify auditing of failed occurrences of event.  The event name is the system-call name  or	the  trusted-event
       name (see audit.h ).

       The command will also accept redirected input, which can be the output of a previously issued command.  This is a file which contains lines
       of the format event [succeed][fail].  If the keyword succeed is present, successful occurrences of that event will be audited; if the  key-
       word  fail  is  present,  failed  occurrences of that event will be audited; if both are present, successful and failed occurrences will be
       audited; if neither keyword is present, that event will not be audited.

       The auditmask command can also be used to set the audit style characteristics of the audit subsystem.  These  characteristics  control  how
       much information is recorded on exec operations.

       The  command  is  used in to initialize the auditmask at boot time according to the file This makes use of privileged operations within the
       system call.

Options
       -f	   Turns on full auditing for the system.  This list may include events which have no symbolic name and are represented only by  a
		   number (reserved for future use); these events will not be audited, despite their presence in the auditmask.

       -n	   Turns off all auditing for the system.

       -s aud_style
		   An  aud_style  of  "exec_argp" enables the auditing of the argument list to an or syscall.  An aud_style of "exec_envp" enables
		   the auditing of the environment strings to an or syscall.

See Also
       audcntl(2)

																      auditmask(8)
All times are GMT -4. The time now is 05:10 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy