Write a shell script that accepts a file name starting and ending line numbers as arguments and displays all the lines between the given line numbers - Code

Latest

programs

Thursday, October 6, 2011

Write a shell script that accepts a file name starting and ending line numbers as arguments and displays all the lines between the given line numbers


(a) Write a shell script that accepts a file name starting and ending line numbers as arguments and displays all the lines between the given line numbers
(b) Write a shell script that deletes all lines containing a specified word I one or  more files supplied as arguments to it.
  

$ awk ‘NR<2 ||  NR> 4 {print $0}’ 5 lines.dat

I/P:      line1
line2
line3
line4
line5

O/P:     line1
            line5


(b) Sol:

i=1
while [ $i -le $# ]
do

grep -v Unix $i > $i

done


No comments:

Post a Comment