|
|
ru.unix.bsd- RU.UNIX.BSD ------------------------------------------------------------------ From : Artem S Ignatiev 2:5020/2395 18 Nov 2006 02:24:40 To : mz1@stlport.org Subject : awk RE -------------------------------------------------------------------------------- 17 ноя 06 19:59, ты слова Valentin Davydov про всяких Re: awk RE: m> From: mz1@stlport.org m> 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}/' >> $ >> >> Это очередная бага в авке или я чего-то не понимаю? >> m> Далее оттуда же: m> For /regular expression/ patterns, the associated statement m> is executed for each input record that matches the regular m> expression. m> Т.е. надо просто матча недостаточно, нужно что-то сделать с ним: m> $ echo 000111 | awk '/^0{3}/p' m> 000111 Ранее оттуда же: A pattern-action statement has the form pattern { action } A missing { action } means print the line; a missing pattern always matches. Pattern-action statements are separated by newlines or semi- colons. [timon@timon timon]$ echo '0{3}111' | awk '/^0{3}/' 0{3}111 [timon@timon timon]$ ZaZooBred [team Бородатые] [ICQ: 67440949] --- Я хожу, как дурак, без блокнота * Origin: Зато палеонтологический музей -- это сКладбище дохлых (2:5020/2395) Вернуться к списку тем, сортированных по: возрастание даты уменьшение даты тема автор
Архивное /ru.unix.bsd/2831455e3777.html, оценка из 5, голосов 10
|