Sponsored Content
Top Forums Shell Programming and Scripting nawk-how count the number of occurances of a pattern, when don't know the pattern Post 302193773 by cyber111 on Sunday 11th of May 2008 03:00:26 AM
Old 05-11-2008
Thanks very much, that worked well. Very compact!
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to count the number of occurences of this pattern?

Hi all, I have a pattern like this in a file: 123 4 56 789 234 5 67 789 121 3 56 789 222 4 65 789 321 6 90 100 478 8 40 789 243 7 80 789 How can I count the number of occurences of '789' (4th column) in this set...? Thanks for all your help! K (7 Replies)
Discussion started by: kripssmart
7 Replies

2. Shell Programming and Scripting

Count the number of occurrences of a pattern between each occurrence of a different pattern

I need to count the number of occurrences of a pattern, say 'key', between each occurrence of a different pattern, say 'lu'. Here's a portion of the text I'm trying to parse: lu S1234L_149_m1_vg.6, part-att 1, vdp-att 1 p-reserver IID 0xdb registrations: key 4156 4353 0000 0000 ... (3 Replies)
Discussion started by: slipstream
3 Replies

3. Shell Programming and Scripting

How to count number of occurances of string in a file?

Gurus, Need little guidance. I have A.txt and B.txt file. B.txt file contains Unique strings. Sample content of B.txt file for which i cut the fourth column uniquely and output directed to B.txt file And A.txt file contains the above string as a fourth column which is last column. So A.txt... (7 Replies)
Discussion started by: Shirisha
7 Replies

4. Shell Programming and Scripting

How to count the number of files starting with a pattern in a Directory

Hi! In our current directory there are around 35000 files. Out of these a few thousands(around 20000) start with, "testfiles9842323879838". I want to count the number of files that have filenames starting with the above pattern. Please help me with the command i could use. Thank... (7 Replies)
Discussion started by: atechcorp
7 Replies

5. Shell Programming and Scripting

Search for a pattern in a String file and count the occurance of each pattern

I am trying to search a file for a patterns ERR- in a file and return a count for each of the error reported Input file is a free flowing file without any format example of output ERR-00001=5 .... ERR-01010=10 ..... ERR-99999=10 (4 Replies)
Discussion started by: swayam123
4 Replies

6. UNIX for Advanced & Expert Users

Count number of lines between a pattern in a large file

1000CUS E Y4NYRETAIL 10010004HELIOPOLIS 110000500022360591000056XX EG 1101DEBY XXAD ZSSKY TSSROS 1102HANYNNYY@HOTMAIL.COM 210030/05/201301/06/2013AED 3100 OPE 3100 CLO 3100 The 1000CUS E Y NYCORPORATE 10010004HELIOPOLIS 110000500025270504550203XX EG 1101XXXQ FOR CTING AND... (1 Reply)
Discussion started by: john2022
1 Replies

7. UNIX for Dummies Questions & Answers

How to find count total number of pattern in a file …?

How to find count total number of pattern in a file … File contains : a.txt ------------- aaa bbb nnn ccc aaa bbb aaa ddd aaa aaa aaa aaa grep -c aaa a.txt Op: 4 ( But my requirement is should count the total no of patterns as 7 ) (4 Replies)
Discussion started by: Jitten
4 Replies

8. Shell Programming and Scripting

Count number of pattern matches per line for all files in directory

I have a directory of files, each with a variable (though small) number of lines. I would like to go through each line in each file, and print the: -file name -line number -number of matches to the pattern /comp/ for each line. Two example files: cat... (4 Replies)
Discussion started by: pathunkathunk
4 Replies

9. Shell Programming and Scripting

Identify file pattern, take count of pattern, then act

Guys - Need your ideas on a section of code to finish something up. To make a long story short, I'm parsing a print output file that goes to pre-printed forms. I'm intercepting it, parsing it, formatting it, cutting it up into individual pages, grabbing the text I want in zones, building an... (3 Replies)
Discussion started by: ampsys
3 Replies

10. UNIX for Beginners Questions & Answers

Grep pattern file and count occurances

Guys I am trying grep to read from pattern file and count occurances of each word. input is firstplace secondplace secondpot patternfile is place first second i want the following. 1-count number of times keywords in patternfile occurs in begining of each line in input file. so... (12 Replies)
Discussion started by: ahfze
12 Replies
compact(1)						      General Commands Manual							compact(1)

Name
       compact, uncompact, ccat - compress and uncompress files, and cat them

Syntax
       compact [name...]
       uncompact [name...]
       ccat [file...]

Description
       The  command compresses the named files using an adaptive Huffman code.	If no file names are given, the standard input is compacted to the
       standard output.  The command operates as an on-line algorithm.	Each time a byte is read, it is encoded immediately according to the  cur-
       rent  prefix  code.   This code is an optimal Huffman code for the set of frequencies seen so far.  It is unnecessary to prepend a decoding
       tree to the compressed file since the encoder and the decoder start in the same state and stay synchronized.  Furthermore, and can  operate
       as filters.  In particular,
	    ... | compact | uncompact | ...
       operates as a (very slow) no-op.

       When  an  argument file is given, it is compacted and the resulting file is placed in file.C; file is unlinked.	The first two bytes of the
       compacted file code the fact that the file is compacted.  This code is used to prohibit recompaction.

       The amount of compression to be expected depends on the type of file being compressed.  Typical values of compression are: Text (38%), Pas-
       cal Source (43%), C Source (36%) and Binary (19%).  These values are the percentages of file bytes reduced.

       The command restores the original file from a file compressed by If no file names are given, the standard input is uncompacted to the stan-
       dard output.

       The command cats the original file from a file compressed by without uncompressing the file.

       The command is present only for compatibility.  In general, the command runs faster and gives better compression.

Restrictions
       The last segment of the file name must contain fewer than thirteen characters to allow space for the appended '.C'.

Files
       compacted file created by compact, removed by uncompact

See Also
       compress(1)

																	compact(1)
All times are GMT -4. The time now is 08:17 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy