How can i write a program using STANDARD UNIX UTILITIES that will read data from standard input one character at a time and out the results to standard output. I know that it runs similar to what a C program in this case. I was told that this could be done in one line of code but never done Unix Pipeline Programming so i am just curious. The purpose of the program is to read data from standard input and count the number of words an lines and out in standard output the total number of words and lines
I came up with the following code but i am unsure:
tr A-Z a-z < file | tr -sc a-z | sort uniq -c wc '\n'
Any thoughts or suggestions on how i can get what i want?
You use
wc(word count) with the-woption to count words in a file or-lfor lines.Other options to
wc: