You're viewing a comment by Piyush Patel and its responses.

Piyush Patel Permalink
July 05, 2014, 06:20

Dear Sir,

I am not fluent in sed but it is very easy to use. Now I have Text file with 7 different pages/sections and there is blankline after each page/section. Now Suppose if I want to get only second page/section. How can I use sed to get the specific section?

Comment Responses

Anirudh Permalink
February 01, 2016, 16:01
sed -e '
# initialize paragraph counter to 1

# each paragraph handled here
# stash the present line ofthe current para to hold space

   # interrogate the paragraph counter
   # a) if success, then print para and quit promptly
   # b) if no, then increment counter and clear hold space

         # SUCCESS
         s///; q
      # NOT THERE YET...

# non-interesting lines

Reply To This Comment

(why do I need your e-mail?)

(Your twitter handle, if you have one.)

Type the word "linux_95": (just to make sure you're a human)

Please preview the comment before submitting to make sure it's OK.