Question: Please use Linux to write the following question: Write a shell script that only prints the odd numbered lines of each file in the current
Please use Linux to write the following question:
Write a shell script that only prints the odd numbered lines of each file in the current directory, except for the script itself. The output should be filename: line for each odd numbered line. You do not need to print line numbers.
Write the script in a way that it works no matter the filename given to the script.
For example, lets say I write a script in a file called test.sh. I then create 3 files(file1,file2,file3), as shown in the screenshot below:


mininetOmininet-um/testS cat file1 line 1 line 2 line 3 line 4 line 5 mininetCmininet-um:test$ cat file2 line 1 line 2 line 3 line 4 line 5 mininetCmininet-um:/test cat file3 line 1 line Z line 3 line 4 line 5
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
