Implement the filters: longLines, linesWith. The filters have similar structure. They accept one parameter from the command line (length limit or a string of characters) and then read, one by one, all lines from the standard input. Each line is tested. The only difference consists in different functions used to reject or accept lines. Functions strlen and strstr could simplify the implementation of the respective filters.
Use the pipeline processing to:
• Print out a sorted list of all words in the file test.txt that are longer then 10 characters.
• Print out a sorted in reverse order all words the file test.txt that are longer that contain the string xxxx.
• Count how many times the word xxx is in the file text.txt.

#include <stdio.h>
#include <ctype.h>

int main(int argc, char* argv[])
{
int c;
int prevC=0;
while ((c=getchar())!=EOF)
{
if (isalpha(c))
putchar(c);
else
if (isalpha(prevC))
putchar('\n');
prevC=c;
}

Someone forgot the CODE tags that were mentioned in the Rules you read when you registered. Not only that, you typed right over exactly how to use them when you entered your message. It helps us help you if you try harder.

You also neglected to format your code. This also helps. Aren't instructors teaching how to properly write code these days?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.