Course Solutions Uncategorized (Solved) : Code Usage Inputfile Textpattern Executes Command Cat Inputfile Grep Textpattern Cut B 1 Q36160712 . . . .

(Solved) : Code Usage Inputfile Textpattern Executes Command Cat Inputfile Grep Textpattern Cut B 1 Q36160712 . . . .

 

2. Pipelined Commands In this portion of the recitation, you will be given nearly complete C code in rec08B.c that implements

code:

/*
* usage: ./a.out input_file text_pattern
* Executes the command “cat input_file | grep text_pattern | cut -b1-10”.
* Note only minimal error checking is done for simplicity/shortnessof code.
*/

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/types.h>
#include <sys/stat.h>

int main(int argc, char **argv)
{
   int status;
   int i;

   if (argc == 3)
   {
       // arguments for commands
       char *cat_args[] = {“cat”, argv[1],NULL};
       char *grep_args[] = {“grep”,argv[2], NULL};
       char *cut_args[] = {“cut”, “-b”,”1-10″, NULL};

       // file descriptors for 2 pipes:fd1 for

OR

PayPal Gateway not configured

OR

PayPal Gateway not configured

Leave a Reply

Your email address will not be published. Required fields are marked *

Related Post