Hi all,
I want write a script to display 5rows at times from a input file.
my out like:
echo " display started"
r1
r2
r3
r4
r5
... Some action items...
again i need next 5 lines.
can you please advise.
Hi all,
I want write a script to display 5rows at times from a input file.
my out like:
echo " display started"
r1
r2
r3
r4
r5
... Some action items...
again i need next 5 lines.
can you please advise.
#!/bin/ksh
current_line=1
total_line=$(cat input_file | wc -l)
while [ $current_line -le $total_line ]; do
awk -v c=$current_line 'NR >= c && NR < c+5' input_file
<Some action items>
<Some action items>
...........................
...........................
$current_line=$(expr $current_line + 5)
done
Just thinking...
built-in to some flavors of unix is the more command.
so a
more testfile -n5
??