Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

How will I run this code on Terminal Unix Mac. I'm beginner please help /Function for CAT : #include #include using namespace std; int main(int

image text in transcribedHow will I run this code on Terminal Unix Mac. I'm beginner please help

/Function for CAT :

#include #include

using namespace std;

int main(int argc,char *argv[]) { ifstream in; // one argument if(argc

image text in transcribed

/////////////////////

// function2.cpp

////////////////////////////////

//FUNCTION FOR GREP

#include #include #include

using namespace std;

int main(int argc,char *argv[]) { ifstream in;

// one argument if(argc

string line; // read each line while(getline(in,line)){ // if string found in line if(line.find(argv[2])!=-1){ // print the line cout

// close file in.close();

return(0); }

image text in transcribed

////////////

// function3.cpp

////////////////////////

//FUNCTION FOR ZIP

#include #include #include #include

using namespace std;

// to encode string

string zip(string str) { // to store encode string string ret=""; // get length of string int len=str.length(); // read each character in a string for(int i=0;i>add; ret+=add; } } // return encoded string return(ret); }

int main(int argc,char *argv[]) {

ifstream in; // one argument if(argc

return(0);

}

image text in transcribed

///////////////////

Requirements wcat is passed in a file and will output the file on the terminal (use cat to familiarize yourself with how this should work) wgrep is passed 2 arguments, the first is the word or words that the user is looking for and the second argument is the file that should be searched (use grep to familiarize yourself with this) wzip is passed a text file and redirects it to a compressed zip file wunzip is passed a zip file and prints out the unzipped file in standard output E:\programc++>function_1 cat testAli.txt This is test for all. adadddddd adadadddd All I have and all line go and I hope they are working solid test it iss E:\programc++> E:\programc++>function2 grep is testall.txt This is test for all. solid test it is E:\programc++> E:\programc++>function3 zip testall.txt This is test for al2. adado adadad4 A12 I have and al2 line go and I hope they are working solid test it is E:\programc++>

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992

More Books

Students also viewed these Databases questions

Question

Prepare a short profile of Henry words worth Longfellow?

Answered: 1 week ago

Question

What is RAM as far as telecommunication is concerned?

Answered: 1 week ago

Question

Question 1: What is reproductive system? Question 2: What is Semen?

Answered: 1 week ago

Question

Describe the sources of long term financing.

Answered: 1 week ago