10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
Hi all,
I have an input file as below. I would like to count the occurrence of pattern matching 8th field for each line.
Input:
field_01 field_02 field_03 field_04 field_05 field_06 field_07 field_08
TA T TA T TA TA TA... (3 Replies)
Discussion started by: huiyee1
3 Replies
2. Shell Programming and Scripting
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
3. UNIX for Dummies Questions & Answers
count occurrence of column3 in column2 with awk
Input:
AA BB
BB AA
BB CC
AA BB
CC AA
CC BB
CC CC
BB BB
Output:
AA BB 3 (1 Reply)
Discussion started by: aydj
1 Replies
4. Shell Programming and Scripting
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
if there's a file containing:
money king money queen money cat money also money king
all those strings are on one line in the file.
how can i find out how many times "money king" shows up in the line?
egrep -c "money king" wont work. (7 Replies)
Discussion started by: SkySmart
7 Replies
6. Shell Programming and Scripting
File 1
aaa
bbb
ccc
File 2
aaa
xxx
zzz
bbb
File 3
aaa
bbb
xxx
Output: (4 Replies)
Discussion started by: Misa-Misa
4 Replies
7. Shell Programming and Scripting
Hi
I have the following file
ENST001 ENST002 4 4 4 88 9 9
ENST004 3 3 3 99 8 8
ENST009 ENST010 ENST006 8 8 8 77 8 8
Basically I want to count how many times ENST* is repeated in each line so the expected results is
2
1
3
Any suggestion please ? (4 Replies)
Discussion started by: fuad_
4 Replies
8. UNIX for Advanced & Expert Users
Need to search a pattern occurrence (count) in a specified file.
Below is the details
$ cat fruits
apple apple
ball ball
apple
ball ball ball
apple apple apple
cat cat
cat cat cat
apple
apple
Note: If I'll use the grep command with -c option then it'll count the 1st occurrence in... (6 Replies)
Discussion started by: tp2115
6 Replies
9. Shell Programming and Scripting
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
10. Shell Programming and Scripting
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