In a file , how to retrieve the lines which are the
multiples of 50 ? like 50,100,150th lines etc.
Answer Posted / shivu
i=50
lines=`wc -l file | cut -d" " -f1`
while [ "$i" -le "$lines" ]
do
head -n $i file | tail -1
i=`expr $i + 50`
done
It works for anything.. :)
Is This Answer Correct ? | 3 Yes | 5 No |
Post New Answer View All Answers
How can I send a mail with a compressed file as an attachment?
Using set -A write a script to print the output of the ls command in 5 columns with two spaces between each column. Pretend that ls does not have multicolumn output.
Is shell scripting a programming language?
What is the first line in every perl script called?
How to print all the arguments provided to the script?
How important is shell scripting?
What is shift command in shell script?
write a shell script to generate a alert ? like when ur birthday came then generate a alert ur birthday is today like that ?
How do I open a jshell in cmd?
What is shell terminal?
Can shell script run on windows?
Is powershell a bash?
What is shell company all about?
What is the significance of the shebang line in shell scripting?
What is console line?