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
What is batch file programming?
what is tickets $ what low,medium,high priorite pls define time also
How can you get the value of pi till a 100 decimal places?
Explain about gui scripting?
Which scripting language is best for automation?
How do I open the shell prompt?
I want to connect to a remote server and execute some commands, how can I achieve this?
Given a file find the count of lines containing the word "abc".
How can the contents of a file inside jar be read without extracting in a shell script?
how to print the 2-d, 3-d arrays in unix shell script programs please answer thi questio to my mail venusaikumar@gmail.com
What is bourne shell scripting?
What is difference between bash and shell?
Calculate a real number calculation directly from the terminal and not any shell script.
What is awk in shell script?
In my bash shell I want my prompt to be of format '$"present working directory":"hostname"> and load a file containing a list of user-defined functions as soon as I log in, how will you automate this?