bug-gawk
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [bug-gawk] Bug


From: Davide Brini
Subject: Re: [bug-gawk] Bug
Date: Thu, 27 Feb 2014 10:35:38 +0100

On Wed, 26 Feb 2014 15:36:05 +0100, "Marko Spröte" <address@hidden> wrote:

> 
> Hi guys,
> what i try is to built a ldap ldif file parser. For my tests i used the
> inetorgperson.ldif. 
> But something goes wrong.
> My source: 
> -----------------------------------------------------------------------------
> #!/usr/bin/gawk -f
>  BEGIN {
>   if(ARGV[1] == NULL){
>    print "Error"
>    exit
>   }
>  }

This way of checking for an empty or unset variable is a bit strange,
though admittedly it works in this case...


>  #    Parse class
>  !/^\#/ && /^objectClass: / {

You don't have to escape the "#", it's not a special character. And you
don't need that check anyway, since if the line matches /^objectClass: /
its first character is obviously not a hash, so you can just do:

/^objectClass: / { do whatever }


>   print $2 # Feld $2 enthält die objectClass.
>  }
>  #    Parse olcAttributeTypes    
>  !/^\#/ && !/^dn: / && !/^cn: / && !/olcObjectClasses/
> && !/objectClass: / { 

To look for an ^olcAttributeTypes line, just do:

/^olcAttributeTypes: / { do whatever }


>   RS = "olcAttributeTypes: \\( "
>   print $0
>  }

I'm not sure which result you wanted to get, but the above is most
certainly not what you wanted or intended. Can you paste a sample of the
output you want to get given the inetorgperson.ldif input?


-- 
D.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]