Let say you want to read file with specific string
than write command
Go to /var/log and log directory let say jasmin where we are going to read message.log file
Commad:
-cat message.log | grep status:CommandStatus.ESME_ROK //hit enter
it will show results with status:CommandStatus.ESME_ROK string.
And if you want to calculate number of lines, word, characters
-cat message.log | grep status:CommandStatus.ESME_ROK | wc
-cat message.log | grep status:CommandStatus.ESME_ROK | wc -l // l for lines
-cat message.log | grep status:CommandStatus.ESME_ROK | wc -w / wo for words
-cat message.log | grep status:CommandStatus.ESME_ROK | wc -c // c for charac
Filter the line and only specified content than add extra command to your command line
-cat message.log | grep status:CommandStatus.ESME_ROK | cut -d " " -f 11 | wc -l
Now what does it mean
get me the content of message.log file where this "status:CommandStatus.ESME_ROK" string abd cut the line replace with empty space and only get field 11 than count word based on number of result lines.
Hope you understand my point.
Comments
Post a Comment