Sponsored Content
Top Forums Shell Programming and Scripting Need script to count specific word and iterate over number of files. Post 302475181 by elamurugu on Saturday 27th of November 2010 01:03:04 AM
Old 11-27-2010
Question Need script to count specific word and iterate over number of files.

Hi Experts,

I want to know the count of specific word in a file. I have almost 600+ files.

So I want to loop thru each file and get the count of the specific word.

Please help me on achieving this...

Many thanks
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Help with scritp to count an specific word into a log

Hello my friends, I need to count how many words are into a log file, I'm using: cat logfile | grep 'word' | wc -l Cuz the 'word' appears once per line. But my logfile grow faster and at the end ofthe day is really big, so how i can count the 'word' only from (by example) line 4000 of... (5 Replies)
Discussion started by: lestat_ecuador
5 Replies

2. UNIX for Dummies Questions & Answers

How to count the occurences of a specific word in a file in bash shell

Hello, I want to count the occurences of a specific word in a .txt file in bash shell. Can somebody help me pleaze?? Thanks!!! (2 Replies)
Discussion started by: mskart
2 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

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. UNIX for Dummies Questions & Answers

Count number of occurences of a word

I want to count the number of occurences of say "200" in a file but that file also contains various stuff including dtaes like 2007 or smtg like 200.1 so count i am getting by doing grep -c "word" file is wrong Please help!!!!! (8 Replies)
Discussion started by: shikhakaul
8 Replies

6. Shell Programming and Scripting

Count the number of occurrences of the word

I am a newbie in UNIX shell script and seeking help on this UNIX function. Please give me a hand. Thanks. I have a large file. Named as 'MyFile'. It was tab-delmited. I am told to write a shell function that counts the number of occurrences of the ord “mysring” in the file 'MyFile'. (1 Reply)
Discussion started by: duke0001
1 Replies

7. UNIX for Dummies Questions & Answers

Unix command to count the number of files with specific characters in name

Hey all, I'm looking for a command that will search a directory (and all subdirectories) and give me a file count for the number of files that contain specific characters within its filename. e.g. I want to find the number of files that contain "-a.jpg" in their name. All the searching I've... (6 Replies)
Discussion started by: murphysm
6 Replies

8. UNIX for Advanced & Expert Users

Count specific word or character per line

Hi, I need help regarding counting specific word or character per line and validate it against a specific number i.e 10. And if number of character equals the specific number then that line will be part of the output. Specific number = 6 Specific word or char = || Sample data:... (1 Reply)
Discussion started by: janzper
1 Replies

9. Shell Programming and Scripting

Script to count number of files in directories

Hi All! I would like to have a script that will count the number of files at the top of the hour of soome directories and mail the results to me. I was thinking on : a=`/directory/subdirectory/ | wc -l` echo "/directory/subdirectory :$a" b=`/another_dir/subdir/ | wc -l` echo... (12 Replies)
Discussion started by: fretagi
12 Replies

10. 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
swapsex(3)						     Library Functions Manual							swapsex(3)

Name
       swap_word,  swap_half, swap_filehdr, swap_aouthdr, swap_scnhdr, swap_hdr, swap_fd, swap_fi, swap_sym, swap_ext, swap_pd, swap_dn, swap_opt,
       swap_aux, swap_reloc, swap_ranlib - swap the sex of the specified structure

Syntax
       #include <sex.h>
       #include <filehdr.h>
       #include <aouthdr.h>
       #include <scnhdr.h>
       #include <sym.h>
       #include <symconst.h>
       #include <cmplrs/stsupport.h>
       #include <reloc.h>
       #include <ar.h>

       long swap_word( word )
       long word;

       short swap_half( half )
       short half;

       void swap_filehdr( pfilehdr, destsex )
       FILHDR *pfilehdr;
       long destsex;

       void swap_aouthdr( paouthdr, destsex )
       AOUTHDR *paouthdr;
       long destsex;

       void swap_scnhdr( pscnhdr, destsex )
       SCNHDR *pscnhdr;
       long destsex;

       void swap_hdr( phdr, destsex )
       pHDRR phdr;
       long destsex;

       void swap_fd( pfd, count, destsex )
       pFDR pfd;
       long count;
       long destsex;

       void swap_fi( pfi, count, destsex )
       pFIT pfi;
       long count;
       long destsex;

       void swap_sym( psym, count, destsex )
       pSYMR psym;
       long count;
       long destsex;

       void swap_ext( pext, count, destsex )
       pEXTR pext;
       long count;
       long destsex;

       void swap_pd( ppd, count, destsex )
       pPDR ppd;
       long count;
       long destsex;

       void swap_dn( pdn, count, destsex )
       pRNDXR pdn;
       long count;
       long destsex;

       void swap_opt( popt, count, destsex )
       pOPTR popt;
       long count;
       long destsex;

       void swap_aux( paux, type, destsex )
       pAUXU paux;
       long type;
       long destsex;

       void swap_reloc( preloc, count, destsex )
       struct reloc *preloc;
       long count;
       long destsex;

       void swap_ranlib( pranlib, count, destsex )
       struct ranlib *pranlib;
       long count;
       long destsex;

Description
       All routines that swap headers take a pointer to a header structure to change the byte's sex. The destsex argument lets	the  swapsex  rou-
       tines decide whether to swap bitfields before or after swapping the words in which they occur. If destsex equals the hostsex of the machine
       you are running on, the flip happens before the swap; otherwise, the flip happens after the swap.  Although not all  routines  swap  struc-
       tures containing bitfields, the destsex is required.

       The  routine  takes  a  pointer to an aux entry and a type, which is a ST_AUX_* constant in cmplrs/stsupport.h.	The constant specifies the
       type of the aux entry to change the sex of.  All other routines are passed a pointer to an array of structures and a count of structures to
       have  the  byte	sex  changed.	The  routines and are macros declared in sex.h.  Only the include files that describe the structures being
       swapped have to be included.

See Also
       gethostsex(3)

								       RISC								swapsex(3)
All times are GMT -4. The time now is 11:40 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy