help-gnu-emacs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Emacs equivalent of the ":g" command in vi


From: C K Kashyap
Subject: Re: Emacs equivalent of the ":g" command in vi
Date: Sat, 23 Jul 2011 08:32:03 +0530

Save your .emacs file: C-x C-s
Mark Rosenthal
mbr@arlsoft.com
P.S. - Interesting side-note.  Did you know that the ed command:

    g/regular _expression_/operation

is where the name "grep" came from?  In ed and ex, the "g" means do a global search for the immediately following regular _expression_, and apply the operation to every matching line.  One such operation is "p" meaning "print".  Using "re" as shorthand for "regular _expression_", the ed command to print every line that matches a particular regular _expression_ is:

                g/re/p



Thank you very much Mark for the detailed explanation and the interesting side note :) I am inclined to the macro approach since the possibilities are endless.

Regards,
Kashyap

reply via email to

[Prev in Thread] Current Thread [Next in Thread]