Sponsored Content
Top Forums Shell Programming and Scripting Counting words from one file in another file Post 302491439 by citaylor on Thursday 27th of January 2011 12:29:07 PM
Old 01-27-2011
Also untested, but pretty near :-)
Code:
for DAT in *.dat
do
CNT="`basename $DAT .dat`".cnt
DIC="`basename $DAT .dat`".dic
awk 'NR==FNR{dic[$1]++; next}dic[$1]{cnt[$1]++}END{ for(c in cnt) print cnt[c]; }' $DIC $DAT > $CNT
done

This User Gave Thanks to citaylor For This Post:
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Counting words in a file

I'm trying to figure out a way to count the number of words in the follwing file: cal 2002 > file1 Is there anyway to do this without using wc but instead using the cut command? (1 Reply)
Discussion started by: r0mulus
1 Replies

2. UNIX for Dummies Questions & Answers

counting words then amending to a file

i want to count the number of words in a file and then redirect this to a file echo 'total number of words=' wc -users>file THis isnt working, anyone any ideas. (1 Reply)
Discussion started by: iago
1 Replies

3. UNIX for Dummies Questions & Answers

counting words

if i have a long list of data, with every line beginning with an ip-address, like this: 62.165.8.187 - - "GET /bestandnaam.html HTTP/1.1" 200 5848 "http://www.domeinnaam.nl/bestandnaam.html" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1)" how do i count which ip-adresses are mentioned... (3 Replies)
Discussion started by: FOBoy
3 Replies

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

5. Programming

Counting the words in a file

Please find the below program. It contains the purpose of the program itself. /* Program : Write a program to count the number of words in a given text file */ /* Date : 12-June-2010 */ # include <stdio.h> # include <stdlib.h> # include <string.h> int main( int argc, char *argv ) {... (6 Replies)
Discussion started by: ramkrix
6 Replies

6. Shell Programming and Scripting

Help in counting the no of repeated words with count in a file

Hi Pls help in solving my doubt.Iam having file like below file1.txt priya jenny jenny priya raj radhika priya bharti bharti Output required: I need a output like count of repeated words with name for ex: priya 3 jenny 2 (4 Replies)
Discussion started by: bha148
4 Replies

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

8. Shell Programming and Scripting

Splitting Concatenated Words in Input File with Words from a Master File

Hello, I have a complex problem. I have a file in which words have been joined together: Theboy ranslowly I want to be able to correctly split the words using a lookup file in which all the words occur: the boy ran slowly slow put child ly The lookup file which is meant for look up... (21 Replies)
Discussion started by: gimley
21 Replies

9. Shell Programming and Scripting

Counting occurrence of all words in a file

Hi, Given below is the input file: http://i53.tinypic.com/2vmvzb8.png Given below is what the output file should look like: http://i53.tinypic.com/1e6lfq.png I know how to count the occurrence of 1 word from a file, but not all of them. Can someone help please? An explanation on the... (1 Reply)
Discussion started by: r4v3n
1 Replies

10. Shell Programming and Scripting

Splitting concatenated words in input file with words from the same file

Dear all, I am working with names and I have a large file of names in which some words are written together (upto 4 or 5) and their corresponding single forms are also present in the word-list. An example would make this clear annamarie mariechristine johnsmith johnjoseph smith john smith... (8 Replies)
Discussion started by: gimley
8 Replies
DAT.CONF(5)															       DAT.CONF(5)

NAME
dat.conf - configuration file for static registration of user-level DAT rdma providers DESCRIPTION
The DAT (direct access transport) architecture supports the use of multiple DAT providers within a single consumer application. Consumers implicitly select a provider using the Interface Adapter name parameter passed to dat_ia_open(). The subsystem that maps Interface Adapter names to provider implementations is known as the DAT registry. When a consumer calls dat_ia_open(), the appropriate provider is found and notified of the consumer's request to access the IA. After this point, all DAT API calls acting on DAT objects are automatically directed to the appropriate provider entry points. A persistent, administratively configurable database is used to store mappings from IA names to provider information. This provider infor- mation includes: the file system path to the provider library object, version information, and thread safety information. The location and format of the registry is platform dependent. This database is known as the Static Registry (SR) and is provided via entries in the dat.conf file. The process of adding a provider entry is termed Static Registration. Registry File Format * All characters after # on a line are ignored (comments). * Lines on which there are no characters other than whitespace and comments are considered blank lines and are ignored. * Non-blank lines must have seven whitespace separated fields. These fields may contain whitespace if the field is quoted with double quotes. Within fields quoated with double quotes, the backslash or qoute are valid escape sequences: * Each non-blank line will contain the following fields: - The IA Name. - The API version of the library: [k|u]major.minor where "major" and "minor" are both integers in decimal format. User-level examples: "u1.2", and "u2.0". - Whether the library is thread-safe: [threadsafe|nonthreadsafe] - Whether this is the default section: [default|nondefault] - The library image, version included, to be loaded. - The vendor id and version of DAPL provider: id.major.minor - ia params, IA specific parameters - device name and port - platform params, (not used) Example netdev entries for OpenFabrics rdma_cm providers, both v1.2 and v2.0 OpenIB-cma u1.2 nonthreadsafe default libdaplcma.so.1 dapl.1.2 "ib0 0" "" ofa-v2-ib0 u2.0 nonthreadsafe default libdaplofa.so.2 dapl.2.0 "ib0 0" "" NOTE: The OpenFabrics providers use <ia_params> to specify the device with one of the following: network address, network hostname, or netdev name; along with port number. The OpenIB- and ofa-v2- IA names are unique mappings. Reserved for OpenFabrics providers. The default location for this configuration file is /etc/dat.conf. The file location may be overridden with the environment variable DAT_OVERRIDE=/your_own_directory/your_dat.conf. SEE ALSO
25 March 2008 DAT.CONF(5)
All times are GMT -4. The time now is 07:11 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy