Question

In: Computer Science

Write CORRECT c code to execute the following command >grep csc411 file.txt | sed s/411/414/g.

Write CORRECT c code to execute the following command

>grep csc411 file.txt | sed s/411/414/g.

Solutions

Expert Solution

RAW CODE

#include<stdio.h>
int main(){

system("grep csc411 file.txt | sed s/411/414/g"); // system executes terminal commands in c
return 0;

}

SCREENSHOTS (CODE,TEXT FILE AND OUTPUT)

CODE

TEXT FILE

OUTPUT (BOTH GREP COMMAND INDIVIDUALLY AND WITH C CODE)

NOTE:- KEEP C FILE IN SAME FOLDER AS FILE.TXT OR CHANGE THE PATH.

##### FOR ANY QUERY, KINDLY GET BACK, THANKYOU. #####


Related Solutions

this is bash scripting. a. Explain the difference between grep and egrep? b. Write a command...
this is bash scripting. a. Explain the difference between grep and egrep? b. Write a command to list files where third letter is x or y? c. Write command to remove array element with id 5
c++Language material choose the correct answer please: 1-lineto(x,y); after execute this command then x and y...
c++Language material choose the correct answer please: 1-lineto(x,y); after execute this command then x and y become the new reference point False True 2-The declaration that is needed for communication between the file and the program is : pointer binary file text file function 3-the largest circle that can be drawn and seen on the screen is circle(getmaxx()/2,getmaxy()/2,getmaxy()/2) circle(getmaxx()/2,getmaxy()/2,getmaxy()) circle(getmaxx()/2,getmaxy()/2,320) no one from other choices 4-If we want to open file "data.txt" to erase it and writing data and read...
Write a Simple C++ Code to show that the Constructors of Composed Classes Execute before Container...
Write a Simple C++ Code to show that the Constructors of Composed Classes Execute before Container Classes.
please explain the following command sequences a) who | grep "Seneca" | sort | uniq >>who<<...
please explain the following command sequences a) who | grep "Seneca" | sort | uniq >>who<< b)sort <names > names c)sort ~/files/phone 1> /dev/null2>phone2 d)ls/root/&> files.log e)ls/etc/>files.log2>&1
C++: Write correct C++ code for a nested if-else if-else structure that will output a message...
C++: Write correct C++ code for a nested if-else if-else structure that will output a message based on the logic below. A buyer can pay immediately or be billed. If paid immediately, then display "a 5% discount is applied." If billed, then display "a 2% discount is applied" if it is paid in 30 days. If between 30 and 60 days, display "there is no discount." If over 60 days, then display "a 3% surcharge is added to the bill."...
Please Write Code in C++ and include the correct #include <header> and not a catchall such...
Please Write Code in C++ and include the correct #include <header> and not a catchall such as bits/stdc: Write a recursive, string-valued function, replace, that accepts a string and returns a new string consisting of the original string with each blank replaced with an asterisk (*) Replacing the blanks in a string involves: Nothing if the string is empty Otherwise: If the first character is not a blank, simply concatenate it with the result of replacing the rest of the...
1. Given the following: C(s) + 2H2(g) → CH4(g)                         ΔH= −74.6 kJ C(s) + 2Cl2(g)...
1. Given the following: C(s) + 2H2(g) → CH4(g)                         ΔH= −74.6 kJ C(s) + 2Cl2(g) → CCl4(g)                       ΔH= −95.7 kJ H2(g) + Cl2(g) → 2HCl(g)                      ΔH= −184.6 kJ Calculate the enthalpy of reaction for: CH4(g) + 4Cl2(g) → CCl4(g) + 4HCl(g) 2. There was a lot of talk among football fans about "deflate-gate" last week (hopefully it's not still going on this week) where the New England Patriots grounds crew seem to have decreased the pressure...
Calculate ΔrH for the following reaction: C(s)+H2O(g)→CO(g)+H2(g) Use the following reactions and given ΔrH's. C(s)+O2(g)→CO2(g), ΔrH=...
Calculate ΔrH for the following reaction: C(s)+H2O(g)→CO(g)+H2(g) Use the following reactions and given ΔrH's. C(s)+O2(g)→CO2(g), ΔrH= -393.5 kJmol−1 2CO(g)+O2(g)→2CO2(g), ΔrH= -566.0 kJmol−1 2H2(g)+O2(g)→2H2O(g), ΔrH= -483.6 kJmol−1 Express your answer using one decimal place.
PYTHON CODE - Write the body of a function second_instance(s, c) which consumes a string s...
PYTHON CODE - Write the body of a function second_instance(s, c) which consumes a string s and a length 1 string c that is contained at least twice in s and returns the index of the second location of c. second_instance: Str Str -> Nat Requires: len(c) == 1 c occurs at least twice in s    Examples: second_instance("banana", "a") => 3 second_instance("bb", "b") => 1 - Write the body of a function make_list(n) which consumes a natural number n...
This code is an expression of cp command in c language. But I don't understand this...
This code is an expression of cp command in c language. But I don't understand this code very well. Please explain in notes one by one.(in detail) #include<stdio.h> #include<stdlib.h> #include<fcntl.h> #include<errno.h> #include<stdlib.h> #include<unistd.h> #include<sys/types.h> #include<sys/stat.h> #include<unistd.h> int main(int argc, char *argv[]) { char ch; int src, dst; struct stat st; if(argc != 3) { printf("argument error \n"); printf("usage: ./a.out src dest \n"); exit(0); } if (stat(argv[1], &st) == -1) { perror("stat : "); exit(-1); } src = open(argv[1], O_RDONLY); if(src...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT