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