Monday, February 5, 2024

Program 3 B.Sc Computer Science with Data analytics Linux and Shell Programming - Lab Bharathiar University - Write a Shell script that accepts a filename, starting and ending line numbers as arguments and displays all the lines between the given line numbers

 

B.Sc Computer Science  with Data analytics

Linux and Shell Programming - Lab  

Bharathiar University 

Program 3- Write a Shell script that accepts a filename, starting and ending line numbers as arguments and displays all the lines between the given line numbers

Source Code

if [ "$#" -ne 3 ]; then

echo "Please Enter <filename> <starting_line> <ending_line> as argument"

exit 1

fi


filename=$1

s=$2

e=$3


sed -n $s,$e\p $filename



Sample Output




No comments:

Post a Comment

Program 12 BCA Madras University BCA Object Oriented Programming using C++ Practical Madras University Program 12 Implement a telephone directory using files

  BCA Object Oriented Programming using C++ Practical Madras University  Program 12  Implement a telephone directory using files SOURCE CODE...