Can anyone help me to count number of occurrence of the strings based on column value. Say i have 300 files with 1000 record length from which i need to count the number of occurrence string which is existing from 213 to 219. Some may be unique and some may be repeated. (8 Replies)
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)
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)
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)
Hi,
I have a file which contained a set of numbers like
Col1 col2 col3 col4
1 sa 13 0
2 sb 14 0
3 sc 15 9
4 sd 16 -9
5 sd 20 -2
6 sd 20 4
Here in last column I need to count the zeros, positive values and negative values,
please help me to do that. (2 Replies)
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)
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
LEARN ABOUT PHP
mb_strrichr
MB_STRRICHR(3) 1 MB_STRRICHR(3)mb_strrichr - Finds the last occurrence of a character in a string within another, case insensitiveSYNOPSIS
string mb_strrichr (string $haystack, string $needle, [bool $part = false], [string $encoding = mb_internal_encoding()])
DESCRIPTION mb_strrichr(3) finds the last occurrence of $needle in $haystack and returns the portion of $haystack. Unlike mb_strrchr(3), mb_strrichr(3)
is case-insensitive. If $needle is not found, it returns FALSE.
PARAMETERS
o $haystack
- The string from which to get the last occurrence of $needle
o $needle
- The string to find in $haystack
o $part
- Determines which portion of $haystack this function returns. If set to TRUE, it returns all of $haystack from the beginning to
the last occurrence of $needle. If set to FALSE, it returns all of $haystack from the last occurrence of $needle to the end,
o $encoding
- Character encoding name to use. If it is omitted, internal character encoding is used.
RETURN VALUES
Returns the portion of $haystack. or FALSE if $needle is not found.
SEE ALSO mb_stristr(3), mb_strrchr(3).
PHP Documentation Group MB_STRRICHR(3)