SED (Linux) – The q or quit command

There is one more simple command that can restrict the changes to a set of lines. It is the "q" command: quit. the third way to duplicate the head command is:

sed '11 q'

which quits when the eleventh line is reached. This command is most useful when you wish to abort the editing after some condition is reached.

The "q" command is the one command that does not take a range of addresses. Obviously the command:

sed '1,10 q'

cannot quit 10 times. Instead:

sed '1 q'

or

sed '10 q'

is correct.

SOURCE

LINK

LANGUAGE
ENGLISH

3 thoughts on “SED (Linux) – The q or quit command”

  1. Hey very cool site!! Man .. Beautiful .. Amazing .. I’ll bookmark your site and take the feeds also…I’m happy to find numerous useful information here in the post, we need develop more strategies in this regard, thanks for sharing. . . . . .

Comments are closed.