Wednesday, May 20, 2020

Unix/AIX box : count word occurrences in text file

Command:
An approach is to transform the content of the input file with tr command so that all words are in a single line and then use grep -c to count that match count.

$ tr '[:space:]' '[\n*]' < example.txt | grep -i -c 'EMPLOYEE_NUMBER'


No comments:

Post a Comment

Featured Post

OIC File Handling – Removing .pgp and Preserving .csv (Dynamic File Name Logic) | use of ast-index-within-string() function

๐Ÿ“Œ Problem Statement In Oracle Integration Cloud (OIC), while working with Stage File, we often receive source files like: a.b.c.csv.pgp ๐Ÿ” ...