Sponsored Content
Full Discussion: Sort and count using AWK
Top Forums Shell Programming and Scripting Sort and count using AWK Post 302361955 by danmero on Wednesday 14th of October 2009 01:24:05 PM
Old 10-14-2009
Code:
awk '{a[substr($0,1,15)]++}END{for(i in a) print a[i],i | "sort -nk2"}' file

 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

How to sort by count

Hello! I have a file with 4 columns. I am trying to have it sort first with respect to the first column, and then with respect to the number of counts (in descending count) in the second column within the same first column identity. For example: Input: 1 2 A 1 1 6 B 2 2 5 G 7 1 6 D 4 1... (1 Reply)
Discussion started by: anchuz
1 Replies

2. UNIX for Dummies Questions & Answers

Sort with respect to count

Hello! I have a file with 4 columns. I am trying to have it sort first with respect to the first column, and then with respect to the number of counts (in descending count) in the second column within the same first column identity. For example: Input: 1 2 A 1 1 6 B 2 2 5 G 7 1 6 D 4... (8 Replies)
Discussion started by: anchuz
8 Replies

3. Shell Programming and Scripting

awk: sort lines by count of a character or string in a line

I want to sort lines by how many times a string occurs in each line (the most times first). I know how to do this in two passes (add a count field in the first pass then sort on it in the second pass). However, can it be done more optimally with a single AWK command? My AWK has improved... (11 Replies)
Discussion started by: Michael Stora
11 Replies

4. Shell Programming and Scripting

Beginner: Count & Sort Using Array's

Hi, I'm new to linux & bash so please forgive my ignorance, just wondering if anyone can help. I have a file (mainfile.txt) with comma deliminated values, like so: $1 $2 $3 613212, 36, 57 613212, 36, 10 613212, 36, 10 677774, 36, 57 619900, 10, 10 i need to split this file... (12 Replies)
Discussion started by: BigTOE
12 Replies

5. Shell Programming and Scripting

Perl - Sort and Count foreach line

Can any one please help I am trying to sort each item in every line and count the common (non case sensitive) and at the end printing all the unique alphabetically. Here is what i did ... I can print all the lines but struck to sort each line some were: I am getting the output as: I... (5 Replies)
Discussion started by: sureshcisco
5 Replies

6. Shell Programming and Scripting

count characters in multiple files and sort

I am trying to count a special character in several thousand files and sort the result according to the number the character occured in each files. files: 1.txt 2.txt 3.txt files look like: ABCDEFGHABBBACF I want the number of B in each file and a result file that lists the occurence... (4 Replies)
Discussion started by: patdoor
4 Replies

7. Shell Programming and Scripting

Advanced: Sort, count data in column, append file name

Hi. I am not sure the title gives an optimal description of what I want to do. Also, I tried to post this in the "UNIX for Dummies Questions & Answers", but it seems no-one was able to help out. I have several text files that contain data in many columns. All the files are organized the same... (14 Replies)
Discussion started by: JamesT
14 Replies

8. Shell Programming and Scripting

awk - count character count of fields

Hello All, I got a requirement when I was working with a file. Say the file has unloads of data from a table in the form 1|121|asda|434|thesi|2012|05|24| 1|343|unit|09|best|2012|11|5| I was put into a scenario where I need the field count in all the lines in that file. It was simply... (6 Replies)
Discussion started by: PikK45
6 Replies

9. Shell Programming and Scripting

Awk: Print count for column in a file using awk

Hi, I have the following input in a file & need output as mentioned below(need counter of every occurance of field which is to be increased by 1). Input: 919143110065 919143110065 919143110052 918648846132 919143110012 918648873782 919143110152 919143110152 919143110152... (2 Replies)
Discussion started by: siramitsharma
2 Replies

10. UNIX for Advanced & Expert Users

Sort words based on word count on each line

Hi Folks :) I have a .txt file with thousands of words. I'm trying to sort the lines in order based on number of words per line. Example from: word word word word word word word word word word word word word word word word to desired output: word (2 Replies)
Discussion started by: martinsmith
2 Replies
GLLINESTIPPLE(3G)														 GLLINESTIPPLE(3G)

NAME
glLineStipple - specify the line stipple pattern C SPECIFICATION
void glLineStipple( GLint factor, GLushort pattern ) delim $$ PARAMETERS
factor Specifies a multiplier for each bit in the line stipple pattern. If factor is 3, for example, each bit in the pattern is used three times before the next bit in the pattern is used. factor is clamped to the range [1, 256] and defaults to 1. pattern Specifies a 16-bit integer whose bit pattern determines which fragments of a line will be drawn when the line is rasterized. Bit zero is used first; the default pattern is all 1's. DESCRIPTION
Line stippling masks out certain fragments produced by rasterization; those fragments will not be drawn. The masking is achieved by using three parameters: the 16-bit line stipple pattern pattern, the repeat count factor, and an integer stipple counter $s$. Counter $s$ is reset to 0 whenever glBegin is called, and before each line segment of a glBegin(GL_LINES)/glEnd sequence is generated. It is incremented after each fragment of a unit width aliased line segment is generated, or after each $i$ fragments of an $i$ width line seg- ment are generated. The $i$ fragments associated with count $s$ are masked out if pattern bit $(s ~/~ "factor") ~roman mod~ 16$ is 0, otherwise these fragments are sent to the frame buffer. Bit zero of pattern is the least significant bit. Antialiased lines are treated as a sequence of $1 times width$ rectangles for purposes of stippling. Whether rectangle $s$ is rasterized or not depends on the fragment rule described for aliased lines, counting rectangles rather than groups of fragments. To enable and disable line stippling, call glEnable and glDisable with argument GL_LINE_STIPPLE. When enabled, the line stipple pattern is applied as described above. When disabled, it is as if the pattern were all 1's. Initially, line stippling is disabled. ERRORS
GL_INVALID_OPERATION is generated if glLineStipple is executed between the execution of glBegin and the corresponding execution of glEnd. ASSOCIATED GETS
glGet with argument GL_LINE_STIPPLE_PATTERN glGet with argument GL_LINE_STIPPLE_REPEAT glIsEnabled with argument GL_LINE_STIPPLE SEE ALSO
glLineWidth(3G), glPolygonStipple(3G) GLLINESTIPPLE(3G)
All times are GMT -4. The time now is 04:07 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy