|
ru.unix.bsd- RU.UNIX.BSD ------------------------------------------------------------------ From : Eugene Grosbein 2:5006/1 02 Dec 2005 20:36:23 To : All Subject : One special feature of sed -------------------------------------------------------------------------------- Привет! man sed говорит: One special feature of sed regular expressions is that they can default to the last regular expression used. If a regular expression is empty, i.e. just the delimiter characters are specified, the last regular expression encountered is used instead. The last regular expression is defined as the last regular expression used as part of an address or sub- stitute command, and at run-time, not compile-time. For example, the command ``/abc/s//XXX/'' will substitute ``XXX'' for the pattern ``abc''. Пишу file.sed: /^[^ ]+ *[^ ]+ ([^ ]+) .*ruleset=check_rcpt, arg1=<([^>]+)>, relay=.*\[(.*)\].*/!d Запускаю sed -El -f file.sed < maillog > /dev/null Работает 7 секунд user time. Дописываю в file.sed: s//\2\3 \1/p Запускаю то же, с ключем -n: sed -n -El -f file.sed < maillog > /dev/null Работает почти 5 минут. Отчего такие тормоза? Eugene -- Смотри, но не смей трогать --- slrn/0.9.8.0 (FreeBSD) * Origin: Svyaz Service JSC (2:5006/1@fidonet) Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.unix.bsd/26093f219f8c9.html, оценка из 5, голосов 10
|