0
votes
2answers
144 views

Count occurrences of line in multiple files

I have log files that I need to grep and count the number of occurrences of a specific line. Issue is that I must start at a specific line of the first file and only count occurrences after that ...
1
vote
3answers
1k views

Count tabs per line in text file with utils

I have a tab-tabulated file. I would like to check if every line has the same number of tabs. For first step, I'd like to print the number of tabs for each individual line. I've tried grep -o '\t' ...
7
votes
3answers
2k views

how to count total number of words in a file?

I am looking for a command to count number of all words in a file. For instance if a file is like this, today is a good day then it should print 5, since there are 5 words there.
4
votes
4answers
533 views

Count lines matching pattern and matching previous line

I want to count the number of times that a role is successfully deleted. The problem is that one line of the log file will show that the script is about to delete the role: Prepare to remove role X ...
2
votes
1answer
3k views

The simplest method to count lines matching specific patterns, including '0' if line is not found?

I have very big logs (several gigabytes per day), that can (but do not need to) contain specific lines. I have to count the number of occurences of every one of these lines on a daily basis. I have a ...