Книга: Learning GNU Emacs, 3rd Edition

5.2.6.4 Using regular expressions to choose files

5.2.6.4 Using regular expressions to choose files

Often you want to select related files and either archive them, move them, compress them, or just delete them. Typically, you use wildcards to select multiple files. In Dired, you use regular expressions. To mark a group of files whose filenames match a regular expression, press % followed by m to mark them with an asterisk.

For example, let's mark all the files that start with ch. Remembering the quick lesson on regular expressions from Chapter 3, ^ finds the beginning of a word, so the regular expression ^ch would mark all the files that start with ch.

Type: %m


Emacs asks for a regular expression so that it can mark the files (Windows).

Type: ^ch Enter


Emacs marks all the files starting with ch and tells you how many it marked.

Sometimes it's more useful to mark files whose contents match a given regular expression. To mark files that contain a certain regular expression, type % g, followed by the regular expression to match (think g for grep if you're familiar with grep).

Now that we've got the files marked, let's talk about what to do with them.

Оглавление книги


Генерация: 1.149. Запросов К БД/Cache: 3 / 0
поделиться
Вверх Вниз