On Fri, 3 Sep 2010 12:01:20 +0200
Arnau Bria wrote:

> Hola a tots,
Hola again,
 
> el meu fitxer és:
> arnau : 12 3 BRIA
> ARNAU
> BRIA
> 
> Hi ha dos apartats que no pillo:
> 
> 1.-) 
> 
> Null strings are removed when they occur as part of a non-null
> command-line argument, while explicit non-null objects are kept. For
> example, to specify that the field separator FS should be set to the
> null string, use:
> 
> awk -F "" 'program' files # correct
> 
> Don't use this:
> awk -F"" 'program' files  # wrong!
> 
> In the second case, awk will attempt to use the text of the program as
> the value of FS, and the first file name as the text of the program!
> This results in syntax errors at best, and confusing behavior at
> worst. 

Val, això he pillat que és un cas especial pel null FS. per la
subsituticó que fa bash del -F"" .


> 2.-) 
> en el tema del case sensitive fa un exemple:
>       
> tolower($1) ~ /foo/  { ... }
> 
> i diu:
> converts the first field to lowercase before matching against it.
> 
> Bé, segons això i el meu fitxer, si faig un
> $ awk 'toupper($1) ~ /arnau/
> > /ARNAU/ {print $0}' kk
> 
> em pass a majúscules el primer camp, i després, si la linia
> conté /ARNAU/ la treu per pantalla. És a dir, hauria de treue:
> 
> arnau : 12 3 BRIA
> ARNAU
> 
> 
> però només treu:
> $ awk 'toupper($1) ~ /arnau/
> /ARNAU/ {print $0}' kk
> ARNAU
> 
> 
> no ho pillo.... com puc fer una acció abans de que evalui l'opració?
i això no té sentit. Estic fent dos passos i no cal. Converteixo a
majúscules i comparo directament:

seria:

$awk 'toupper($1) ~  /ARNAU/' kk
arnau : 12 3 ramirez
ARNAU

en fi,

juan palomo :-)

-- 
Arnau Bria
http://blog.emergetux.net
Bombing for peace is like fucking for virginity
--
_______________________________________________
Comandob mailing list
[email protected]
http://lists.badopi.org/mailman/listinfo/comandob

Responder a