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


Cat: cat command is used to create the file
Syntax: cat > file name for creation
Syntax: cat file name for displaying a file
Sed: sed means stream editor it can be used for editing the main program by using sed

					echo "enter the filename"
read fname
echo "enter the starting line number"
read s
echo "enter the ending line number"
read n
sed -n $s,$n\p $fname | cat > newline
cat newline
21312 2 clothing 325

Leave a Reply