Write a Linux shell script that prints only given no. of lines from top & bottom of a file, Unix program to print numbers from top & bottom of a file
Program
clear
echo-n "Enter file name:"
read fn
echo-n "No. of line:"
read n
t='head-$n<$fn'
b='tail-$n<$fn'
echo"Top:"
echo$b
Output:
Enter file name: temp.sh
No. of line:3
Note : 3 lines from top and 3 lines from bottom are displayed here.
<<< Previous || Current || Next >>>
No comments:
Post a Comment