[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

L.8 Otros comandos de búsqueda e iteración

Here are some other commands that find matches for a regular expression. They all ignore case in matching, if the pattern contains no upper-case letters and case-fold-search is non-nil. Aside from occur, all operate on the text from point to the end of the buffer, or on the active region in Transient Mark mode.

M-x occur RET regexp RET

Display a list showing each line in the buffer that contains a match for regexp. To limit the search to part of the buffer, narrow to that part (@pxref{Narrowing}). A numeric argument n specifies that n lines of context are to be displayed before and after each matching line.

The buffer `*Occur*' containing the output serves as a menu for finding the occurrences in their original context. Click Mouse-2 on an occurrence listed in `*Occur*', or position point there and type RET; this switches to the buffer that was searched and moves point to the original of the chosen occurrence.

M-x list-matching-lines

Synonym for M-x occur.

M-x how-many RET regexp RET

Print the number of matches for regexp that exist in the buffer after point. In Transient Mark mode, if the region is active, the command operates on the region instead.

M-x flush-lines RET regexp RET

Delete each line that contains a match for regexp, operating on the text after point. In Transient Mark mode, if the region is active, the command operates on the region instead.

M-x keep-lines RET regexp RET

Delete each line that does not contain a match for regexp, operating on the text after point. In Transient Mark mode, if the region is active, the command operates on the region instead.

You can also search multiple files under control of a tags table (see section Searching and Replacing with Tags Tables) or through Dired A command (see section Operating on Files), or ask the grep program to do it (@pxref{Grep Searching}).


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by Roberto on abril, 2 2007 using texi2html 1.76.