Sponsored Content
Top Forums Shell Programming and Scripting Count no of occurrence of the strings based on column value Post 302517131 by zooby on Tuesday 26th of April 2011 07:10:40 AM
Old 04-26-2011
Test data (Input data):

IN46236 TRE 317-691-741947558020901EN1HGCM82614A0001722004HONDA ACCORD U-S- 0001-01-012011-04-112011-04-11A12345FBurd Ford, Inc.
GA30214 TRE 000-000-000094536775208EN1HGCM72673A0013972003HONDA ACCORD U-S- 0001-01-012011-04-072011-04-07B12345LAllan Vigil Ford of Fayetteville, Inc.
CO80503 TRE 720-438-456709740713120ENJHLRE48569C0025272009HONDA CR-V 0001-01-012011-04-092011-04-08C23456ALongmont Ford
AZ85743 TRE 000-000-000058715232407ENJTEDW21AX600040012006TOYOTA HIGHLANDER 0001-01-012011-04-092011-04-09D78636CHolmes Tuttle Ford, Lincoln-Mercury
NH03055 TRE 603-867-465107757895420EN5J6YH28574L0059762004HONDA ELEMENT 0001-01-012011-04-122011-04-12A12345LBest Ford Lincoln
GA30540 TRE 706-635-589558241949120ENJTMZF33V29D0062112009TOYOTA RAV4 0001-01-012011-04-072011-04-07A12345DRonnie Thompson Ford-Mercury
CA92376 TRE 909-877-153353033524707ENKNAFE1624750071172007KIA SPECTRA5 0001-01-012011-04-122011-04-12C23456DCitrus Motors
AR71646 TRE 870-853-572147762329806EN1NXBU40E79Z0075622009TOYOTA COROLLA 0001-01-012011-04-072011-04-07A12345VRyburn Motor Company, Inc.
MN56071 TRE 952-686-146403434361620EN4A3AB76S66E0108782006MITSUBIGALANT 0001-01-012011-04-062011-04-06A12345XNew Prague Ford Lincoln Mercury
MD21286 TRE 410-337-722287552922909ENJTEBT14R1480109092004TOYOTA 4RUNNER 0001-01-012011-04-122011-04-12B12345LBob Davidson Ford Lincoln
FL33067 TRE 954-592-941240740545220ENJNKCV61EX9M0114092009INFINITG37 0001-01-012011-04-092011-04-09A12345LMaroone Ford of Margate
MI49224 TRE 614-307-460899043860620EN5J6RE4H35BL0119092011HONDA CR-V 0001-01-012011-04-012011-04-01A12345VAlbion Motors Ford, Inc.

Output:
Out of 12 lines we have 7 strings repeated and reset of them are 2 and 1 which are existing in same column value.
A12345 - 7
B12345 - 2
C23456 - 2
D78636 - 1
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

count a occurrence

I am looking to get a output of "2 apple found" from the awk command below. black:34104 tomonorisoejima$ cat tomo apple apple black:34104 tomonorisoejima$ awk '/apple/ {count++}END{print count " apple found"}' tomo 1 apple found black:34104 tomonorisoejima$ (5 Replies)
Discussion started by: soemac
5 Replies

2. UNIX for Dummies Questions & Answers

Occurrence of two strings in a line of a file

Hi all, is there a way to find the occurrence of two strings in a line of a file? e.g. I have XXXX yyyyy zzzz 111 XXXX yyyyy zzzz 222 XXXX yyyyy zzzz 333 XXXX yyyyy zzzz 444 and want to find in one shot XXXX yyyyy zzzz 222 Thank you,... (9 Replies)
Discussion started by: f_o_555
9 Replies

3. UNIX for Dummies Questions & Answers

count number of rows based on other column values

Could anybody help with this? I have input below ..... david,39 david,39 emelie,40 clarissa,22 bob,42 bob,42 tim,32 bob,39 david,38 emelie,47 what i want to do is count how many names there are with different ages, so output would be like this .... david,2 emelie,2 clarissa,1... (3 Replies)
Discussion started by: itsme999
3 Replies

4. Shell Programming and Scripting

Count occurrence of string in a column using awk

Hi, I want to count the occurrences of strings in a column and display as in example below: Input: get1 345 789 098 get2 567 982 090 fet4 777 610 632 get1 800 544 230 get1 600 788 451 get2 892 321 243 get1 673 111 235 fet3 789 220 278 fet4 768 222 341 output: 4 get1 345 789... (7 Replies)
Discussion started by: aydj
7 Replies

5. Shell Programming and Scripting

awk to sum a column based on duplicate strings in another column and show split totals

Hi, I have a similar input format- A_1 2 B_0 4 A_1 1 B_2 5 A_4 1 and looking to print in this output format with headers. can you suggest in awk?awk because i am doing some pattern matching from parent file to print column 1 of my input using awk already.Thanks! letter number_of_letters... (5 Replies)
Discussion started by: prashob123
5 Replies

6. Shell Programming and Scripting

Insert Columns before the last Column based on the Count of Delimiters

Hi, I have a requirement where in I need to insert delimiters before the last column of the total delimiters is less than a specified number. Say if the delimiters is less than 139, I need to insert 2 columns ( with blanks) before the last field awk -F 'Ç' '{ if (NF-1 < 139)} END { "Insert 2... (5 Replies)
Discussion started by: arunkesi
5 Replies

7. Programming

awk to count occurrence of strings and loop for multiple columns

Hi all, If i would like to process a file input as below: col1 col2 col3 ...col100 1 A C E A ... 3 D E G A 5 T T A A 6 D C A G how can i perform a for loop to count the occurences of letters in each column? (just like uniq -c ) in every column. on top of that, i would also like... (8 Replies)
Discussion started by: iling14
8 Replies

8. UNIX for Dummies Questions & Answers

Count occurrence of string (based on type) in a column using awk

Hello, I have a table that looks like what is shown below: AA BB CC XY PQ RS AA BB CC XY RS I would like the total counts depending on the set they belong to: if search pattern is in {AA, BB, CC} --> count them as Type1 | wc -l (3 Replies)
Discussion started by: Gussifinknottle
3 Replies

9. Shell Programming and Scripting

Count of occurrence in particular column of the file.

Hi All, let's say an input looks like: C1,C2,C3,C4,C5,C6,C7,C8,C9,C10,C11 ---------------------------------- 1|0123452|C501|Z|Z|Z|E|E|E|E|E|E|E 1|0156123|C501|X|X|X|E|E|E|E|E|E|E 1|0178903|C501|Z|Z|Z|E|E|E|E|E|E|E 1|0127896|C501|Z|Z|Z|E|E|E|E|E|E|E 1|0981678|C501|X|X|X|E|E|E|E|E|E|E ... (6 Replies)
Discussion started by: suresh_target
6 Replies

10. Shell Programming and Scripting

Count occurrence of column one unique value having unique second column value

Hello Team, I need your help on the following: My input file a.txt is as below: 3330690|373846|108471 3330690|373846|108471 0640829|459725|100001 0640829|459725|100001 3330690|373847|108471 Here row 1 and row 2 of column 1 are identical but corresponding column 2 value are... (4 Replies)
Discussion started by: angshuman
4 Replies
NWDIAG(1)						      General Commands Manual							 NWDIAG(1)

NAME
rackdiag - generate rack-structure-diagram image file from spec-text file. SYNOPSIS
rackdiag [options] files DESCRIPTION
This manual page documents briefly the rackdiag commands. rackdiag is generate sequence-diagram image file from spec-text file. OPTIONS
These programs follow the usual GNU command line syntax, with long options starting with two dashes (`-'). A summary of options is included below. For a complete description, see the Info files. -h, --help show this help message and exit. --version show program's version number and exit. -a, --antialias Pass diagram image to anti-alias filter. -c FILE, --config=FILE read configurations from FILE. -o FILE write diagram to FILE. -f FONT, --font=FONT use FONT to draw diagram. -T TYPE Output diagram as TYPE format. SEE ALSO
The programs are documented fully by http://blockdiag.com/en/nwdiag/ AUTHOR
rackdiag was written by Takeshi Komiya <i.tkomiya@gmail.com> This manual page was written by Kouhei Maeda <mkouhei@palmtb.net>, for the Debian project (and may be used by others). June 11, 2011 NWDIAG(1)
All times are GMT -4. The time now is 11:53 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy