1. Write a single line shell command to run the C program above
and remove all words "a" from the file news.txt
2. Please write a C program remove Word.c to obtain the input from
standard input and remove all word "the".
3. Please write a C program countSentence.c to obtain the input
from standard input and count the number of sentences. Assume a
sentence should end with ., .",?or!
4. Please write a C program listFreq.c to list the frequency of
each word from the standard inpu
Please find my implementation for Q3.
Please repost others in separate post.
#include<stdio.h>
#include<string.h>
int main()
{
char paragraph[10000];
int number_of_characters,number_of_sentence=0,i;
printf("Enter paragraph:\n");
fgets(paragraph, 10000, stdin);
// get number of characters
number_of_characters= strlen(paragraph);
for (i=0; i<number_of_characters; i++)
{
if (paragraph[i]=='.' ||(paragraph[i]=='.' &&
paragraph[i+1]=='"') || paragraph[i]=='?' ||
paragraph[i]=='!')
{
number_of_sentence++;
}
}
printf("Total number of sentences in the paragraph is: %d",
number_of_sentence);
return 0;
}
1. Write a single line shell command to run the C program above and remove all...
Write a C program to run on ocelot to read a text file and print it to the display. It should optionally find the count of the number of words in the file, and/or find the number of occurrences of a substring, and/or take all the words in the string and sort them lexicographically (ASCII order). You must use getopt to parse the command line. There is no user input while this program is running. Usage: mywords [-cs] [-f substring]...
Write a single command line to accomplish the following tasks in Python 1- Count the number of instances of each item in a list and produce another list of lists containing each item and its count. (Use the list count method) 2- Remove all words containing a capital letter at the end in a given string. (Use the join and ends with methods) 3- Remove every other letter from a string
//I NEED THE PROGRAM IN C LANGUAGE!// QUESTION: I need you to write a program which manipulates text from an input file using the string library. Your program will accept command line arguments for the input and output file names as well as a list of blacklisted words. There are two major features in this programming: 1. Given an input file with text and a list of words, find and replace every use of these blacklisted words with the string...
Help please Write a program named one.c that takes a single command-line argument, the name of a file. Your program should read all the strings (tokens) from this file and write all the strings that are potentially legal words (the string contains only upper-case and lower-case characters in any combination) to the file words. Your program should ignore everything else (do not write those strings anywhere 1. As an example, running /a.out dsia would result in the generation of the...
1) Write a single line UNIX command to list all sh files matching the multiple conditions below: • at directory "/home/test" • filename containing "exam" 2) Write a single line UNIX command to check if "/home/exam2" in the PATH variable. 3) How to obtain the value of command line arguments in a shell program? 4) Write a single line UNIX command to run an executable Java program Hello at background and output the number of lines in the result. 5)...
C Programming Language on Linux - Word Frequency Program Please write a Program in C that will accept a text file name as a command-line argument via a main program that will do the following: First, read the file (first pass) and create a linked list of words (in their order of occurrence), with the frequency of each word set to 0. Then, read the file (second pass) and for each word identified, search the linked list, and when found,...
Objective: Use input/output files, strings, and command line arguments. Write a program that processes a text file by removing all blank lines (including lines that only contain white spaces), all spaces/tabs before the beginning of the line, and all spaces/tabs at the end of the line. The file must be saved under a different name with all the lines numbered and a single blank line added at the end of the file. For example, if the input file is given...
1) Write a C program that displays all the command line arguments that appear on the command line when the program is invoked. Use the file name cl.c for your c program. Test your program with cl hello goodbye and cl 1 2 3 4 5 6 7 8 and cl 2) Write a C program which displays the sum of the command line arguments. Hint: use sscanf to convert the decimal arguments (which are strings) to binary numbers that...
Write a C program that parses a string (command line) and tokenize it by breaking the string characters into words that are separated by delimiters that can be white spaces (space and/or tab characters). It also must report how many commands in the input. This program will be reused for your next C programming assignment that is a simple shell interpreter/program called "tech shell". % a.out please enter a string: this is a test 1: this 2: is 3: a...
You are required to write a C program on Unix/Linux in which the parent process creates three child processes, lets them run concurrently, and waits for them to return and prints their exit status. The three child processes are assigned different tasks. Child one is to calculate and display the highest mark of a class of ten students for a unit. Child one is required to get the marks from the standard input (i.e. the keyboard). Child two is to...