linux user group brescia

immagine del castello

Archivio della mailing list

[LugBS] grep regex

necro necro a circolab.net
Ven 9 Ott 2009 19:34:54 UTC
On Fri, Oct 09, 2009 at 09:21:13PM +0200, Carlo Bertoldi wrote:
> E fa quello che mi aspetto. Poi ho pensato di cambiare l'asterisco con un +
> e grep non torna piu' alcuna riga.
> Perche'?
da man 1 grep :
   Basic vs Extended Regular Expressions
          In basic regular expressions the meta-characters ?, +, {, |,
	  (, and ) lose their special meaning; instead use the
	  backslashed versions \?, \+, \{, \|, \(, and \).

Quindi o usi
du -h | grep "^[0-9]\+M"
o usi
du -h | grep -E "[0-9]+M"




-- 
Nicolo' Cristini 

PGP Key id: 0xDED6220C
PGP Key fingerprint = 80F5 34DA 9759 C8C3 0385  5657 C3F0 D216 DED6 220C
-------------- parte successiva --------------
Un allegato non testuale รจ stato rimosso....
Nome:        signature.asc
Tipo:        application/pgp-signature
Dimensione:  198 bytes
Descrizione: Digital signature
URL:         <http://lugbs.linux.it/pipermail/lug/attachments/20091009/c503427b/attachment.pgp>


Maggiori informazioni sulla lista Lug