Delete 40 lines after every 24 lines from a file

Hello,

I have file of more than 10000 lines.

I want to delete 40 lines after every 20 lines.

e.g from a huge file, i want to delete line no from 34 - 74, then 94 - 134 etc and so on.

Please let me know how i can do it.

Best regards,

The first deletion would start from line no 21 as per the logic !?
Or I misunderstood something? Please explain if possible with example.

What about the first 14 lines? And is it 20 or 24 lines (see thread header)? And, 34 - 74 will be deleting 41 lines. Please improve your specification.

First 14 lines has to be deleted. Actually no.s quoted by me can vary. As an e.g we can take that i want to print lines no 34-74 then 94-134 then 154 -174 and so on.

i.e. i want to print fixed length of lines (here 21) every time after deleting fixed length of lines (here 39)...

Hope i am able to clarify.

Delete lines 34-74 then 94-134 then 154 -174 and so on, you mean? And first 14 lines?
Then 15-33 would remain and 75-93 and 135-153, i.e. 19 lines every time...
Try:

awk '!((NR-s)%m),!((NR-s-p+1)%m)' s=15 m=60 p=19 file

You get the idea. I used parameters so you can twiddle the knobs..

Can you please describe how it is working?

Does it work for you?

Not exactly. this is the reason i am asking you so that i can change the parameter so that it can work as per my requirement...

Ok, but first, what does not work?

It is printing line 13-31 ,,73-91,,133-151 etc whereas i want to print from line 34-74, 94-134 etc...
A quick reply would be of great help

Hi, just so you realize. This is contradictory to what you said in post #1 (delete is not the same as print), which some posters asked questions about, which lead to your post #4, which is contradicting both post #1 and in turn itself (the length would be 41, not 21) and both posts are contradicting your thread header. That is why I asked the question in #5, which you did not answer.

By doing this, you waste other people's precious time in which they volunteer to help, instead wondering what it is that you could be meaning.

Apart from the fact that you also cannot ask posters to hurry up or be quick:

--
Everyone at the UNIX and Linux Forums gives their best effort to reply to all questions in a timely manner. For this reason, posting questions with subjects like "Urgent!" or "Emergency" and demanding a fast reply are not permitted in the regular forums.

For members who want a higher visibility to their questions, we suggest you post in the Emergency UNIX and Linux Support Forum. This forum is given a higher priority than our regular forums.

Posting a new question in the Emergency UNIX and Linux Support Forum requires forum Bits. We monitor this forum to help people with emergencies, but we do not not guarantee response time or best answers. However, we will treat your post with a higher priority and give our best efforts to help you.
--

You would probably have received a reply 2 days ago if post #1 and the header would have been accurate. So please think of this next time.

If you have read through all of this just try changing s to 34 and p to 41.
Are you still interested in an explanation?

I am so sorry..
yes, i would prefer explanation..so, please provide...