awk question
    Oliver Fromme 
    olli at lurza.secnetix.de
       
    Thu Apr  9 06:33:17 PDT 2009
    
    
  
Len Conrad <lconrad at go2france.com> 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.  
If ";" is the delimiter character, you need to tell awk
about it (i.e. use the -F option).  This one should work:
awk  -F';'  '$3 ~ /^[a-z]{5}$/ {print}'  file
If that still doesn't work for you, please specify your
file format more exactly, and provide an example of the
input lines.
Best regards
   Oliver
-- 
Oliver Fromme, secnetix GmbH & Co. KG, Marktplatz 29, 85567 Grafing b. M.
Handelsregister: Registergericht Muenchen, HRA 74606,  Geschäftsfuehrung:
secnetix Verwaltungsgesellsch. mbH, Handelsregister: Registergericht Mün-
chen, HRB 125758,  Geschäftsführer: Maik Bachmann, Olaf Erb, Ralf Gebhart
FreeBSD-Dienstleistungen, -Produkte und mehr:  http://www.secnetix.de/bsd
"anyone new to programming should be kept as far from C++ as
possible;  actually showing the stuff should be considered a
criminal offence" -- Jacek Generowicz
    
    
More information about the freebsd-questions
mailing list