I am looking for a way to search a file for a specific pattern '.00' and want to calculate how often it appears. grep -o '.00' file does this quite well. Unfortunately I do not know how to exclude any pattern which contains the pattern I want to have but is a longer string.

What I want to have :

number of times, '.00' appears in the file

What I want to exclude :

longer patterns like '0.000001' so everything '*.00*'

Does anybody have an idea? Could I do something like "grep -o ('.00' and not '*.00*') ?

Thanks in advance, advice and boosting appreciated.

Follow

@IntegralDuChemin do it like this

something | grep ".00" | grep -v ".00*"

@freemo Ah I see. Just a stupid question - what means "something" in that case? Another command for displaying my file like "less file"? Thanks in any case

@IntegralDuChemin yea another command, find makes the most sense if you wanna go recursive

Sign in to participate in the conversation
Qoto Mastodon

QOTO: Question Others to Teach Ourselves
An inclusive, Academic Freedom, instance
All cultures welcome.
Hate speech and harassment strictly forbidden.