Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

What is batch file programming?

1105


what is tickets $ what low,medium,high priorite pls define time also

2093


How can you get the value of pi till a 100 decimal places?

921


Explain about gui scripting?

1043


Which scripting language is best for automation?

893


How do I open the shell prompt?

1139


I want to connect to a remote server and execute some commands, how can I achieve this?

975


Given a file find the count of lines containing the word "abc".

1496


How can the contents of a file inside jar be read without extracting in a shell script?

1083


how to print the 2-d, 3-d arrays in unix shell script programs please answer thi questio to my mail venusaikumar@gmail.com

2520


What is bourne shell scripting?

921


What is difference between bash and shell?

1012


Calculate a real number calculation directly from the terminal and not any shell script.

1152


What is awk in shell script?

1174


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?

1070