1 Reply Latest reply on Apr 14, 2015 3:14 PM by richard mcleod

    Any grammar file experts out there?

    richard mcleod

      Stuff is completely confusing to me. I found the documentation here (Syntax for grammar files - BMC Server Automation 8.5 - BMC Documentation)


      How do I update a grammar after I've previously added it? How do I delete a grammar I don't need? --Not seeing any blcli for this


      Is there any documentation that describes the actual concept of grammar files in BL? Like its great that the current documentation describes the various components of grammar files but I'm just completely lost. What's the structure, dos, donts, etc


      Like can I do something like this? Consecutive lines are considered comments but lines where there is comment then a non-comment are considered a line?


      COMMENT #.*\n#.*

      LINE #.*\n.*


      comment COMMENT $save_as_comment $0

      record LINE $new_field $0 $save_record $0 $set_add_rule $0


      add $write_field $0


      Also! Are there any utilities that would help test grammars against files before implementing. The process of deploying the file to every appserver and then running a blcli command to create a NEW grammar file is a bit cumbersome especially if you're trying to test something

        • 1. Re: Any grammar file experts out there?
          richard mcleod

          I think what I want to do with a grammar file is impossible...


          Take this for example


          cat someconfig.file

          #this is a testline

          this is a value


          #another label

          yet another value


          #this is a badlabel




          blah blah


          Have it working with awk but not sure if this is feasible in a grammar (essentially finding a comment line, then checking that the next line is not a comment, if it is a comment, ignore both lines, if its not a comment, write the comment to the name field, write the non-comment to the value field)


          awk 'BEGIN { FS="\n"; RS=""; } /^#/ { if ($2!~/^#/)print $1","$2 }' someconfig.file

          #this is a testline,this is a value

          #another label,yav

          #somethingelse,blah blah