On Wed, 8 Apr 2009, Len Conrad wrote:


We need to print a line when the 3rd field (with trailing ";" delimiter) is, 
eg, exactly 5 lower case characters

awk ' $3 ~ /^[a-z]{5,5};$/ {print $0} ' file

... doesn't work.

Suggestions?

Please give an example of the line this doesn't work on, and exactly what you want it to do.

"{5}" is probably acceptable instead of "{5,5}". I don't do much awk, but here's a Perl example:

perl -e '$x = "abcde;"; print "Yes\n" if $x =~ /^[a-z]{5};$/'

-Warren Block * Rapid City, South Dakota USA
_______________________________________________
freebsd-questions@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/freebsd-questions
To unsubscribe, send any mail to "freebsd-questions-unsubscr...@freebsd.org"

Reply via email to