Sponsored Content
Top Forums UNIX for Dummies Questions & Answers awk Grouping and Subgrouping with Counts Post 302776061 by Don Cragun on Wednesday 6th of March 2013 01:06:29 AM
Old 03-06-2013
Quote:
Originally Posted by JoshCrosby
Thank you so much, based on the dataset it is perfect.. however on the larger files it takes quite a while which is fine. The one issue is that its not taking product (column 1) into account and seems to be grouping on the count

Any ideas? I sincerely appreciate your help.

Some logic
-> product (sort by top 3 - based on how many rows it appears on)
----> skew (sort by top 5 skews from the products found above)
----> count of skews

I hope that helps explain a bit more.
A bit more, yes. But still not clear. In your sample input there are 6 occurrences each of products p1, p2, p3, and p4. You say you want the top 3 products, but your sample output only shows 2. (And since there are four products with the same number of occurrences, you don't say how to choose which 3 of those 4 should be chosen.) Your sample output didn't show the top 2 product/skew pairs p1/12345 and p2/23456 both of which appear 6 times even though p1 and p2 appear the same number of times as p3 and p4???

From what you did with your 1 count sample, you chose the last two of the set of the four most common products based on the fact that their product names sorted last. Is that really what you want?

If there are ties, should your results include all products that match the number of occurrences of the third most common product? If there are ties in the number of appearances of a skew within a product, should the results include all skews with the fifth most common skew within that product?

Will a single skew ever appear with more than one product, or are skews supposed to be unique to a product.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

counts

How can i do a simple record count in my shell script? i just want to count the number of records i receive from a specific file. (11 Replies)
Discussion started by: k@ssidy
11 Replies

2. UNIX for Dummies Questions & Answers

counts

To start I have a table that has ticketholders. Each ticket holder has a unique number and each ticket holder is associated to a so called household number. You can have multiple guests w/i a household. I would like to create 3 flags (form a, for a household that has 1-4 gst) form b 5-8 gsts... (3 Replies)
Discussion started by: sbr262
3 Replies

3. Shell Programming and Scripting

Grouping using sed/awk ?

I run awk cat $1|awk '{print $6}' and get a lot of results and I want results to group them. For example my result is (o/p is unknown to user) xyz xyz abc pqr xyz pqr etc I wanna group them as xyz=total found 7 abc=total .... pqr= Thank (3 Replies)
Discussion started by: pujansrt
3 Replies

4. Shell Programming and Scripting

awk grouping by name script

Hello I am trying to figure out a script which could group a log file by user names. I worked with awk command and I could trim the log file to: <USER: John Frisbie > /* Thu Aug 06 2009 15:11:45.7974 */ FLOAT GRANT WRITE John Frisbie (500 of 3005 write) <USER: Shawn Sanders > /* Thu Aug 06... (2 Replies)
Discussion started by: Avto
2 Replies

5. Shell Programming and Scripting

AWK script to create max value of 3rd column, grouping by first column

Hi, I need an awk script (or whatever shell-construct) that would take data like below and get the max value of 3 column, when grouping by the 1st column. clientname,day-of-month,max-users ----------------------------------- client1,20120610,5 client2,20120610,2 client3,20120610,7... (3 Replies)
Discussion started by: ckmehta
3 Replies

6. Shell Programming and Scripting

awk and perl grouping.

Hello folks. After awk, i have decided to start to learn perl, and i need some help. I have following output : 1 a 1 b 2 k 2 f 3 s 3 p Now with awk i get desired output by issuing : awk ' { a = a FS $2 } END { for ( i in a) print i,a }' input 1 a b 2 k f 3 s p Can... (1 Reply)
Discussion started by: Peasant
1 Replies

7. Shell Programming and Scripting

grouping using sed or awk

I have below inside a file. 11.22.33.44 user1 11.22.33.55 user2 I need this manipulated as alias server1.domain.com='ssh user1@11.22.33.44' alias server2.domain.com='ssh user2@11.22.33.55' (3 Replies)
Discussion started by: anil510
3 Replies

8. UNIX for Dummies Questions & Answers

awk adding counts together from column

Hello Im new treat me nicely, I have a headache :) I have a script that seemed to work now it doesnt anyway, the last part is adding counts of unique items in a csv file eg 05492U34 38 05492U34 47 two columns, (many different values like this in file) i want... (7 Replies)
Discussion started by: aniquebmx
7 Replies

9. Shell Programming and Scripting

Grouping and Subgrouping using awk

I have a data which looks like 1440993600|L|ABCDEF 1440993600|L|ABCD 1440993601|L|ABCDEF 1440993602|L|ABC 1440993603|L|ABCDE . . . 1441015200|L|AB 1441015200|L|ABC 1441015200|L|ABCDEF So basically, the $1 is epoch date, $2 and $3 is some application data From one if the... (5 Replies)
Discussion started by: hemanty4u
5 Replies

10. Shell Programming and Scripting

Output counts of all matching strings lessthan a number using awk

The awk below is supposed to count all the matching $5 strings and count how many $7 values is less than 20. I don't think I need the portion in bold as I do not need any decimal point or format, but can not seem to get the correct counts. Thank you :). file chr5 77316500 77316628 ... (6 Replies)
Discussion started by: cmccabe
6 Replies
STLICENSE(1M)															     STLICENSE(1M)

NAME
stlicense - server access control program for X SYNOPSIS
stlicense [-v] [-fp directory] {-fn typeface | -pr product} [[+-]netdev ...] DESCRIPTION
The stlicense program is run interactively by the font administrator to give devices attached to hosts on the network, netdevs, access to typefaces. Responsibility for maintaining security rests with users root, bin, and the owners of the font directories. OPTIONS
stlicense accepts the command line options described below. -fp directory The path of directories to search for the specified product or typeface. The directories must have the suffix .st or they will be ignored. If several directories are specified, they are separated by the colon (":") character. Stlicense will search the path until it finds a directory that contains the specified product or typeface. It will use that directory for all of its operations. If no -fp option is specifies, the value of environment variable STPATH is used. If neither -fp nor STPATH is present, the default path is /usr/lib/X11/fonts/ifo.st. -fn typeface The typeface being licensed. It is specified as an XLFD font name. The entire font name does not have to be specified. The pro- gram will use the first typeface whose name matches the name specified. -pr product Specifying a product instead of a typeface provides a convenient way to license collections of typefaces. Product names are estab- lished when typefaces are loaded. Use either the -fn or the -pr option, but never both. One of them must be present for license additions or removals. -v The verbose option controls the number of messages returned. By default, stlicense prints messages only when a request could not be fulfilled. With the verbose option, status messages are printed for all licensing requests. -help If this is the only option specified, a brief message listing the valid options to stlicense will be printed. +netdev The netdev is granted a license to the product or typeface specified. Adding a product license to the netdev means adding licenses to all of the typefaces which comprise the product. The netdev is specified in the form host:device. The host name is a node on the network. They can be discless nodes, workstations, and the like. The device, usually a printer, is attached to the host. The name of the device must be a valid file name. Special host STSYSTEM refers to all nodes on the network; typefaces licensed to STSYSTEM are available to every host. Special device DISPLAYS refers to all servers running on the host. Special device PRINTERS refers to all printers connected to the host. The host defaults to the host on which stlicense is running. The device defaults to DISPLAYS. Adding a product license to a netdev which already has a license for the product causes the net- dev's fonts.dir file to be updated with the current definition of the product. -netdev The license for specified typeface or product is removed from this netdev. netdev The products/typefaces licensed for this netdev are displayed. If the -pr or -fn option is specified, stlicense reports whether the specified product or typeface is licensed for this netdev. In the case of typefaces, only those that have been individually licensed with the -fn option (that is, not licensed as part of a product with the -pr option) can be queried by this option. As with addition and removal of licenses, the host and device portions of the netdev specification default to `hostname` and DIS- PLAYS (respectively). So running stlicense without any [+|-]netdev arguments is identical to specifying an argument of `host- name`:DISPLAYS; licensing information is returned for device DISPLAYS for the host on which stlicense is running. FILES
This program updates the netdev's license files in the licenses subdirectory of the typeface directory (*.st). It creates and deletes licensing files as necessary. If files for the netdev do not exist, it creates them. Deleting the last license from a netdev will cause the netdev's licensing files to be deleted. Hosts have directories in licenses. Devices have directories within their host's directory. Typefaces available to the netdev are stored in fonts.dir. Product licenses issued to the netdev are stored in products.dir. The typefaces that comprise valid products are specified in the products directory of typeface directories (*.st). EXAMPLES
stlicense -pr builtin +STSYSTEM:DISPLAYS Licenses the Intellifont fonts contained in the product "builtin" (and listed in /usr/lib/X11/fonts/ifo.st/products/builtin) for all dis- plays. stlicense -fp /usr/lib/X11/fonts/type1.st -pr builtin +STSYSTEM:DISPLAYS Licenses the Type 1 fonts contained in the product "builtin" (and listed in /usr/lib/X11/fonts/type1.st/products/builtin) for all displays. SEE ALSO
stload(1M), stmkfont(1), stconv(1M), stmkdirs(1) COPYRIGHT
Copyright 1990, Hewlett-Packard Company See X(1) for a full statement of rights and permissions. X Version 11 Release 5 STLICENSE(1M)
All times are GMT -4. The time now is 11:58 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy