This command will begin reading the first line, in this case the command:- '$q" wiil do nothing (if it is not the last line)- 'N' will append the first line to the second- '11,$D' will do nothing, since it is not yet the line 11- ':ba' will go back to 'a'

The process will continue until sed gets the line 11 (if the text has less than 11 lines, then it will just print all lines)

After getting the line 11 something changes, let's see:

- '$q' will quit just if it is the last line.- 'N" append the line number 11 to the others-'11,$D' will delete just the first line (as it is said in the man of the sed: "Delete up to the first embedded newline in the pattern space")-':ba' will restart the process

From now on the first line of the stream will be always deleted in each cycle, so just the last 11 lines will remain until the last line be reached.

Who is online

Users browsing this forum: No registered users and 4 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum