It's still not very clear to me. But I'll give it a shot in the dark:
THe awk command works as follows (explanation on the first line of input):
It takes the last field after dash and number(s):
, then it throws away everything beyond the last number
and counts the occurrences of these.
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)
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)
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)
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)
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)
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)
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)
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)
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
LEARN ABOUT PHP
mb_strripos
MB_STRRIPOS(3) 1 MB_STRRIPOS(3)mb_strripos - Finds position of last occurrence of a string within another, case insensitiveSYNOPSIS
int mb_strripos (string $haystack, string $needle, [int $offset], [string $encoding = mb_internal_encoding()])
DESCRIPTION mb_strripos(3) performs multi-byte safe strripos(3) operation based on number of characters. $needle position is counted from the beginning
of $haystack. First character's position is 0. Second character position is 1. Unlike mb_strrpos(3), mb_strripos(3) is case-insensitive.
PARAMETERS
o $haystack
- The string from which to get the position of the last occurrence of $needle
o $needle
- The string to find in $haystack
o $offset
- The position in $haystack to start searching
o $encoding
- Character encoding name to use. If it is omitted, internal character encoding is used.
RETURN VALUES
Return the numeric position of the last occurrence of $needle in the $haystack string, or FALSE if $needle is not found.
SEE ALSO strripos(3), strrpos(3), mb_strrpos(3).
PHP Documentation Group MB_STRRIPOS(3)