Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Given a file of humongous size, I can edit with ed, then issue the following command.


Which will print out all lines containing 'real'.

What I want to do is print the first 20.

I know sed, grep, head, etc. But I want to improve my ed skills.

share|improve this question
I don't know ed, but | head -n20? –  Rob Feb 5 '13 at 18:35
Hi, trying to find solution only using ed. –  Bryan Hunt Feb 5 '13 at 18:49

1 Answer 1

You can specify ranges before your commands in the form from,to.


would print lines 1-4.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.