Question: 3) Write a shell script myFile which will output the total number of lines in the file whose name will be given by the

3) Write a shell script myFile which will output the total number 

3) Write a shell script myFile which will output the total number of lines in the file whose name will be given by the user. Also, it will read certain lines from the file and put them in a new file called (newFile). For example, in the command bellow test is the name of the file given by the user 100 is the starting line number and 150 is the ending line number. Your code will output the lines from 100-150 in the file "newFile". If the numbers of lines in the file are less than 100 or 150 then the program will output a message saying; "Lines do not exist in file". You can assume that user will give a file name which exists in the current directory. Hints: Use wc to count number of lines, use sed to read/print the lines. Use > to store them in newFile $myFile test 100 150

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!