awk RE
- From
- Artem S. Ignatiev (2:5020/2395)
- To
- mz1@stlport.org (2:5054/37.63)
- Date
- 2006-11-18T01:24:40Z
- Area
- RU.UNIX.BSD
Вижу вас хорошо --- слышу вас плохо, mz1!
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)
SEEN-BY: 50/12 400/814 450/1024 5000/5000 5011/13 5012/46 5015/28 5019/31
SEEN-BY: 5020/400 545 2238 2395 2871 4441 5021/29 5025/3 5027/12 5030/1080
SEEN-BY: 5030/1957 5035/38 5045/7 5054/1 4 8 9 11 28 35 36 37 45 63 66 67 70
SEEN-BY: 5054/75 84 85 5059/9 5062/10 5063/3 5064/7 5076/1 5077/70 5080/1003
SEEN-BY: 5084/9 5085/13 5095/20 5096/18 6001/10
PATH: 5020/2395 545 5054/1 37