Hola a tots, estic fent una lectura del manual de awk (un gran desconegut per mi fora de les 4 típiques operacions) i em trobo amb alguna cosa que no entnec.
**Sigueu bons que estic pel principi del manual, tot just acabant les expressions regulars :-) 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. però si faig awk -F: o awk -F : $ awk -F "" '{print $1}' kk a A B $ awk -F"" '{print $1}' kk *es penja $ awk -F: '{print $1}' kk arnau ARNAU BRIA $ awk -F : '{print $1}' kk arnau ARNAU BRIA si que funciona. Algú m'explica el significat dels pàrrafs d'abans? No pillo quean l'espai en blanc és vàlid i quan no. 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ó? gràcies per endavant! -- Arnau Bria http://blog.emergetux.net Bombing for peace is like fucking for virginity -- _______________________________________________ Comandob mailing list Comandob@badopi.org http://lists.badopi.org/mailman/listinfo/comandob