Write a simple C program that processes a text file and removesany and all duplicate lines, outputting the unique lines to a newoutput file in the original order in which they appeared. Yourprogram will take the input and output file names as command-linearguments. The easiest way to approach this problem is to usegetFileLines function and store the return value in a 2D array ofcharacters. After this, you use 2 for loops to compare the valuesin the string and also set up a flag variable which would check forany duplicate values in your string.
2. Write a program that processes a text file and removes any and all duplicate lines, outputting the unique lines to a new output file in the original order in which they appeared. Your program will take the input and output file names as command line arguments. For example, if the input file has the following contents, I am the Doctor, and you are the Daleks! 2 I hate yogurt. 3 It’s just stuff with bits in. 4 I’m the Doctor. 5 I am the Doctor, and you are the Daleks! 6 Annihilate? 7 I hate yogurt. Assignment 4 – Computer Science I 1 / 3 8 It’s just stuff with bits in. 9 I won’t stand for it. 10 Not now, not ever, do you understand me?! 11 Not now, not ever, do you understand me?! 12 I hate yogurt. 13 I am the Doctor, and you are the Daleks! The resulting output file would contain: 1 I am the Doctor, and you are the Daleks! 2 I hate yogurt. 3 It’s just stuff with bits in. 4 I’m the Doctor. 5 Annihilate? 6 I won’t stand for it. 7 Not now, not ever, do you understand me?! Place all of your source code in a file named uniqueLines.c Show transcribed image text 2. Write a program that processes a text file and removes any and all duplicate lines, outputting the unique lines to a new output file in the original order in which they appeared. Your program will take the input and output file names as command line arguments. For example, if the input file has the following contents, I am the Doctor, and you are the Daleks! 2 I hate yogurt. 3 It’s just stuff with bits in. 4 I’m the Doctor. 5 I am the Doctor, and you are the Daleks! 6 Annihilate? 7 I hate yogurt. Assignment 4 – Computer Science I 1 / 3 8 It’s just stuff with bits in. 9 I won’t stand for it. 10 Not now, not ever, do you understand me?! 11 Not now, not ever, do you understand me?! 12 I hate yogurt. 13 I am the Doctor, and you are the Daleks!
The resulting output file would contain: 1 I am the Doctor, and you are the Daleks! 2 I hate yogurt. 3 It’s just stuff with bits in. 4 I’m the Doctor. 5 Annihilate? 6 I won’t stand for it. 7 Not now, not ever, do you understand me?! Place all of your source code in a file named uniqueLines.c
Expert Answer
Answer to Write a simple C program that processes a text file and removes any and all duplicate lines, outputting the unique lines…