|
ru.unix.bsd- RU.UNIX.BSD ------------------------------------------------------------------ From : mz1@stlport.org 2:5020/400 17 Nov 2006 20:59:58 To : Valentin Davydov Subject : Re: awk RE -------------------------------------------------------------------------------- Valentin Davydov <val@sqdp.trc-net.co.jp> wrote: > $ man awk > Patterns are arbitrary Boolean combinations (with ! || &&) of regular > expressions and relational expressions. Regular expressions are as in > egrep; see grep(1). Isolated regular expressions in a pattern apply to > the entire line. Regular expressions may also occur in relational > expressions, using the operators ~ and !~. /re/ is a constant regular > expression; any string (constant or variable) may be used as a regular > expression, except in the position of an isolated regular expression in > a pattern. > > $ echo 000111 | egrep '^0{3}' > 000111 > $ echo 000111 | awk '/^0{3}/' > $ > > Это очередная бага в авке или я чего-то не понимаю? > > Вал. Дав. Далее оттуда же: For /regular expression/ patterns, the associated statement is exe- cuted for each input record that matches the regular expression. Т.е. надо просто матча недостаточно, нужно что-то сделать с ним: $ echo 000111 | awk '/^0{3}/p' 000111 Андрей Левочкин --- ifmail v.2.15dev5.3 * Origin: Demos online service (2:5020/400) Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.unix.bsd/657743b95a95.html, оценка из 5, голосов 10
|