(command.CommandList
  children: [
    (command.ShFunction
      keyword: <Id.KW_Function function>
      name_tok: <err_exit>
      name: err_exit
      body: 
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.Simple
              blame_tok: <print>
              more_env: []
              words: [{<print>} {<-u2>} {<-n>} {(DQ <Id.Lit_BadBackslash '\\'> <t>)}]
              redirects: []
              do_fork: T
            )
            (command.Simple
              blame_tok: <print>
              more_env: []
              words: [
                {<print>}
                {<-u2>}
                {<-r>}
                {(${ Id.VSub_Name Command) <Id.Lit_LBracket '['> ($ Id.VSub_Number 1) 
                  <Id.Lit_RBracket ']'> <Id.Lit_Colon ':'>
                }
                {
                  (DQ 
                    (BracedVarSub
                      left: <Id.Left_DollarBrace '${'>
                      token: <Id.VSub_At '@'>
                      var_name: '@'
                      suffix_op: (suffix_op.Slice begin:{<Id.Lit_Digits 2>})
                      right: <Id.Arith_RBrace _>
                    )
                  )
                }
              ]
              redirects: []
              do_fork: T
            )
            (command.Simple
              blame_tok: <let>
              more_env: []
              words: [{<let>} {<Id.Lit_VarLike 'Errors+='> <1>}]
              redirects: []
              do_fork: T
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
    )
    (command.Simple
      blame_tok: <alias>
      more_env: []
      words: [{<alias>} {<Id.Lit_VarLike 'err_exit='> (SQ <'err_exit $LINENO'>)}]
      redirects: []
      do_fork: T
    )
    (command.ShAssignment
      left: <Id.Lit_VarLike 'Command='>
      pairs: [
        (AssignPair
          left: <Id.Lit_VarLike 'Command='>
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'Command='> name:Command)
          op: assign_op.Equal
          rhs: 
            {
              (BracedVarSub
                left: <Id.Left_DollarBrace '${'>
                token: <Id.VSub_Number 0>
                var_name: 0
                suffix_op: 
                  (suffix_op.Unary
                    op: <Id.VOp1_DPound '##'>
                    arg_word: {<Id.Lit_Other '*'> <Id.Lit_Slash '/'>}
                  )
                right: <Id.Right_DollarBrace '}'>
              )
            }
        )
      ]
      redirects: []
    )
    (command.Simple
      blame_tok: <integer>
      more_env: []
      words: [{<integer>} {<Id.Lit_VarLike 'Errors='> <0>}]
      redirects: []
      do_fork: T
    )
    (command.AndOr
      children: [
        (command.ShAssignment
          left: <Id.Lit_VarLike 'tmp='>
          pairs: [
            (AssignPair
              left: <Id.Lit_VarLike 'tmp='>
              lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'tmp='> name:tmp)
              op: assign_op.Equal
              rhs: 
                {
                  (CommandSub
                    left_token: <Id.Left_DollarParen '$('>
                    child: 
                      (command.Simple
                        blame_tok: <mktemp>
                        more_env: []
                        words: [{<mktemp>} {<-dt>}]
                        redirects: []
                        do_fork: T
                      )
                    right: <Id.Eof_RParen _>
                  )
                }
            )
          ]
          redirects: []
        )
        (BraceGroup
          left: <Id.Lit_LBrace '{'>
          children: [
            (command.Sentence
              child: 
                (command.Simple
                  blame_tok: <err_exit>
                  more_env: []
                  words: [{<err_exit>} {<mktemp>} {<-dt>} {<failed>}]
                  redirects: []
                  do_fork: T
                )
              terminator: <Id.Op_Semi _>
            )
            (command.Sentence
              child: (command.ControlFlow keyword:<Id.ControlFlow_Exit exit> arg_word:{<1>})
              terminator: <Id.Op_Semi _>
            )
          ]
          redirects: []
          right: <Id.Lit_RBrace '}'>
        )
      ]
      ops: [<Id.Op_DPipe _>]
    )
    (command.Simple
      blame_tok: <trap>
      more_env: []
      words: [{<trap>} {(DQ <'cd /; rm -rf '> ($ Id.VSub_DollarName tmp))} {<EXIT>}]
      redirects: []
      do_fork: T
    )
    (command.ShAssignment
      left: <Id.Lit_VarLike 'tmp1='>
      pairs: [
        (AssignPair
          left: <Id.Lit_VarLike 'tmp1='>
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'tmp1='> name:tmp1)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName tmp) <'/tmp1.csv'>}
        )
      ]
      redirects: []
    )
    (command.ShAssignment
      left: <Id.Lit_VarLike 'tmp2='>
      pairs: [
        (AssignPair
          left: <Id.Lit_VarLike 'tmp2='>
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'tmp2='> name:tmp2)
          op: assign_op.Equal
          rhs: {($ Id.VSub_DollarName tmp) <'/tmp2.csv'>}
        )
      ]
      redirects: []
    )
    (command.Simple
      blame_tok: <cat>
      more_env: []
      words: [{<cat>}]
      redirects: [
        (Redir
          op: <Id.Redir_Great '>'>
          loc: (redir_loc.Fd fd:1)
          arg: {($ Id.VSub_DollarName tmp1)}
        )
        (Redir
          op: <Id.Redir_DLessDash '<<-'>
          loc: (redir_loc.Fd fd:0)
          arg: 
            (redir_param.HereDoc
              here_begin: {(word_part.EscapedLiteral token:<Id.Lit_EscapedChar '\\E'> ch:E) <OF>}
              here_end_tok: <Id.Undefined_Tok ''>
              stdin_parts: [
                <'CAT,"CVE CCODE","NECA OCN",ST,LATA,AP,"New InterState\n'>
                <'Orig","New Inter""""State\n'>
                <'Term","New IntraState\n'>
                <'Orig","New IntraState\n'>
                <'Term"\r\n'>
                <'CLEC,XXXX,AAAA,RB,ABC,comp," 0.2 "," 0.4 "," 0.6 "," 0.8 "\r\n'>
                <'CLEC,YYYY,QQQQ,SX,123,mmmm," 0.3 "," 0.5 "," 0.7 "," 0.9 "\r\n'>
              ]
            )
        )
      ]
      do_fork: T
    )
    (command.Simple
      blame_tok: <integer>
      more_env: []
      words: [{<integer>} {<Id.Lit_VarLike 'count='> <0>} {<nfields>}]
      redirects: []
      do_fork: T
    )
    (command.ShAssignment
      left: <Id.Lit_VarLike 'IFS='>
      pairs: [
        (AssignPair
          left: <Id.Lit_VarLike 'IFS='>
          lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'IFS='> name:IFS)
          op: assign_op.Equal
          rhs: 
            {
              (BracedVarSub
                left: <Id.Left_DollarBrace '${'>
                token: <Id.VSub_Number 2>
                var_name: 2
                suffix_op: (suffix_op.Unary op:<Id.VTest_Hyphen _> arg_word:{<','>})
                right: <Id.Right_DollarBrace '}'>
              )
            }
        )
      ]
      redirects: []
    )
    (command.ForEach
      keyword: <Id.KW_For for>
      iter_names: [j]
      iterable: (for_iter.Words words:[{<1>} {<2>}])
      body: 
        (command.DoGroup
          left: <Id.KW_Do do>
          children: [
            (command.Simple
              blame_tok: <typeset>
              more_env: []
              words: [{<typeset>} {<-a>} {<arr>}]
              redirects: []
              do_fork: T
            )
            (command.WhileUntil
              keyword: <Id.KW_While while>
              cond: 
                (condition.Shell
                  commands: [
                    (command.Simple
                      blame_tok: <read>
                      more_env: []
                      words: [{<read>} {<-A>} {<-S>} {<arr>}]
                      redirects: []
                      do_fork: T
                    )
                  ]
                )
              body: 
                (command.DoGroup
                  left: <Id.KW_Do do>
                  children: [
                    (command.DParen
                      left: <Id.Op_DLeftParen _>
                      child: 
                        (arith_expr.BinaryAssign
                          op_id: Id.Arith_Equal
                          left: ($ Id.Lit_ArithVarLike nfields)
                          right: 
                            {
                              (BracedVarSub
                                left: <Id.Left_DollarBrace '${'>
                                token: <Id.VSub_Name arr>
                                var_name: arr
                                prefix_op: <Id.VSub_Pound '#'>
                                bracket_op: (bracket_op.WholeArray op_id:Id.Lit_At)
                                right: <Id.Right_DollarBrace '}'>
                              )
                            }
                        )
                      right: <Id.Op_DRightParen _>
                      redirects: []
                    )
                    (command.If
                      if_kw: <Id.KW_If if>
                      arms: [
                        (IfArm
                          keyword: <Id.KW_If if>
                          cond: 
                            (condition.Shell
                              commands: [
                                (command.DParen
                                  left: <Id.Op_DLeftParen _>
                                  child: 
                                    (arith_expr.Binary
                                      op_id: Id.Arith_DEqual
                                      left: 
                                        (arith_expr.UnaryAssign
                                          op_id: Id.Arith_DPlus
                                          child: ($ Id.Lit_ArithVarLike count)
                                        )
                                      right: {<Id.Lit_Digits 1>}
                                    )
                                  right: <Id.Op_DRightParen _>
                                  redirects: []
                                )
                              ]
                            )
                          then_kw: <Id.KW_Then then>
                          action: [
                            (command.AndOr
                              children: [
                                (command.DParen
                                  left: <Id.Op_DLeftParen _>
                                  child: 
                                    (arith_expr.Binary
                                      op_id: Id.Arith_DEqual
                                      left: ($ Id.Lit_ArithVarLike nfields)
                                      right: {<Id.Lit_Digits 10>}
                                    )
                                  right: <Id.Op_DRightParen _>
                                  redirects: []
                                )
                                (command.Simple
                                  blame_tok: <err_exit>
                                  more_env: []
                                  words: [{<err_exit>} {(SQ <'first record should contain 10 fields'>)}]
                                  redirects: []
                                  do_fork: T
                                )
                              ]
                              ops: [<Id.Op_DPipe _>]
                            )
                            (command.AndOr
                              children: [
                                (command.DBracket
                                  left: <Id.KW_DLeftBracket '[['>
                                  expr: 
                                    (bool_expr.Binary
                                      op_id: Id.BoolBinary_GlobDEqual
                                      left: 
                                        {
                                          (BracedVarSub
                                            left: <Id.Left_DollarBrace '${'>
                                            token: <Id.VSub_Name arr>
                                            var_name: arr
                                            bracket_op: 
                                              (bracket_op.ArrayIndex
                                                expr: {<Id.Lit_Digits 7>}
                                              )
                                            right: <Id.Right_DollarBrace '}'>
                                          )
                                        }
                                      right: 
                                        {
                                          (SingleQuoted
                                            left: <Id.Left_DollarSingleQuote '$\''>
                                            tokens: [
                                              <Id.Char_Literals 'New Inter""State'>
                                              <Id.Char_OneChar '\\n'>
                                              <Id.Char_Literals Term>
                                            ]
                                            right: <Id.Right_SingleQuote '\''>
                                          )
                                        }
                                    )
                                  right: <Id.Lit_DRightBracket ']]'>
                                  redirects: []
                                )
                                (command.Simple
                                  blame_tok: <err_exit>
                                  more_env: []
                                  words: [
                                    {<err_exit>}
                                    {
                                      (SingleQuoted
                                        left: <Id.Left_DollarSingleQuote '$\''>
                                        tokens: [
                                          <Id.Char_Literals 
'7th field of record 1 should contain New Inter""State'
                                          >
                                          <Id.Char_OneChar '\\n'>
                                          <Id.Char_Literals Term>
                                        ]
                                        right: <Id.Right_SingleQuote '\''>
                                      )
                                    }
                                  ]
                                  redirects: []
                                  do_fork: T
                                )
                              ]
                              ops: [<Id.Op_DPipe _>]
                            )
                          ]
                          spids: [253 264]
                        )
                      ]
                      else_action: []
                      fi_kw: <Id.KW_Fi fi>
                      redirects: []
                    )
                    (command.ForExpr
                      keyword: <Id.KW_For for>
                      init: 
                        (arith_expr.BinaryAssign
                          op_id: Id.Arith_Equal
                          left: ($ Id.Lit_ArithVarLike i)
                          right: {<Id.Lit_Digits 0>}
                        )
                      cond: 
                        (arith_expr.Binary
                          op_id: Id.Arith_Less
                          left: ($ Id.Lit_ArithVarLike i)
                          right: ($ Id.Lit_ArithVarLike nfields)
                        )
                      update: 
                        (arith_expr.UnaryAssign
                          op_id: Id.Node_PostDPlus
                          child: ($ Id.Lit_ArithVarLike i)
                        )
                      body: 
                        (command.DoGroup
                          left: <Id.KW_Do do>
                          children: [
                            (command.ShAssignment
                              left: <Id.Lit_VarLike 'delim='>
                              pairs: [
                                (AssignPair
                                  left: <Id.Lit_VarLike 'delim='>
                                  lhs: (sh_lhs_expr.Name left:<Id.Lit_VarLike 'delim='> name:delim)
                                  op: assign_op.Equal
                                  rhs: {($ Id.VSub_DollarName IFS)}
                                )
                              ]
                              redirects: []
                            )
                            (command.If
                              if_kw: <Id.KW_If if>
                              arms: [
                                (IfArm
                                  keyword: <Id.KW_If if>
                                  cond: 
                                    (condition.Shell
                                      commands: [
                                        (command.DParen
                                          left: <Id.Op_DLeftParen _>
                                          child: 
                                            (arith_expr.Binary
                                              op_id: Id.Arith_DEqual
                                              left: ($ Id.Lit_ArithVarLike i)
                                              right: 
                                                (arith_expr.Binary
                                                  op_id: Id.Arith_Minus
                                                  left: ($ Id.Lit_ArithVarLike nfields)
                                                  right: {<Id.Lit_Digits 1>}
                                                )
                                            )
                                          right: <Id.Op_DRightParen _>
                                          redirects: []
                                        )
                                      ]
                                    )
                                  then_kw: <Id.KW_Then then>
                                  action: [
                                    (command.ShAssignment
                                      left: <Id.Lit_VarLike 'delim='>
                                      pairs: [
                                        (AssignPair
                                          left: <Id.Lit_VarLike 'delim='>
                                          lhs: 
                                            (sh_lhs_expr.Name
                                              left: <Id.Lit_VarLike 'delim='>
                                              name: delim
                                            )
                                          op: assign_op.Equal
                                          rhs: 
                                            {
                                              (SingleQuoted
                                                left: <Id.Left_DollarSingleQuote '$\''>
                                                tokens: [
                                                  <Id.Char_OneChar '\\r'>
                                                  <Id.Char_OneChar '\\n'>
                                                ]
                                                right: <Id.Right_SingleQuote '\''>
                                              )
                                            }
                                        )
                                      ]
                                      redirects: []
                                    )
                                  ]
                                  spids: [341 355]
                                )
                              ]
                              else_action: []
                              fi_kw: <Id.KW_Fi fi>
                              redirects: []
                            )
                            (command.If
                              if_kw: <Id.KW_If if>
                              arms: [
                                (IfArm
                                  keyword: <Id.KW_If if>
                                  cond: 
                                    (condition.Shell
                                      commands: [
                                        (command.DParen
                                          left: <Id.Op_DLeftParen _>
                                          child: 
                                            (arith_expr.Binary
                                              op_id: Id.Arith_DEqual
                                              left: ($ Id.Lit_ArithVarLike i)
                                              right: {<Id.Lit_Digits 1>}
                                            )
                                          right: <Id.Op_DRightParen _>
                                          redirects: []
                                        )
                                      ]
                                    )
                                  then_kw: <Id.KW_Then then>
                                  action: [
                                    (command.Simple
                                      blame_tok: <printf>
                                      more_env: []
                                      words: [
                                        {<printf>}
                                        {(DQ <'%#q%s'>)}
                                        {
                                          (DQ 
                                            (BracedVarSub
                                              left: <Id.Left_DollarBrace '${'>
                                              token: <Id.VSub_Name arr>
                                              var_name: arr
                                              bracket_op: 
                                                (bracket_op.ArrayIndex
                                                  expr: ($ Id.Lit_ArithVarLike i)
                                                )
                                              right: <Id.Right_DollarBrace '}'>
                                            )
                                          )
                                        }
                                        {(DQ ($ Id.VSub_DollarName delim))}
                                      ]
                                      redirects: []
                                      do_fork: T
                                    )
                                  ]
                                  spids: [367 377]
                                )
                              ]
                              else_kw: <Id.KW_Else else>
                              else_action: [
                                (command.Simple
                                  blame_tok: <printf>
                                  more_env: []
                                  words: [
                                    {<printf>}
                                    {(DQ <'%(csv)q%s'>)}
                                    {
                                      (DQ 
                                        (BracedVarSub
                                          left: <Id.Left_DollarBrace '${'>
                                          token: <Id.VSub_Name arr>
                                          var_name: arr
                                          bracket_op: 
                                            (bracket_op.ArrayIndex
                                              expr: ($ Id.Lit_ArithVarLike i)
                                            )
                                          right: <Id.Right_DollarBrace '}'>
                                        )
                                      )
                                    }
                                    {(DQ ($ Id.VSub_DollarName delim))}
                                  ]
                                  redirects: []
                                  do_fork: T
                                )
                              ]
                              fi_kw: <Id.KW_Fi fi>
                              redirects: []
                            )
                          ]
                          right: <Id.KW_Done done>
                        )
                      redirects: []
                    )
                  ]
                  right: <Id.KW_Done done>
                )
              redirects: [
                (Redir
                  op: <Id.Redir_Less '<'>
                  loc: (redir_loc.Fd fd:0)
                  arg: {($ Id.VSub_DollarName tmp1)}
                )
                (Redir
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {($ Id.VSub_DollarName tmp2)}
                )
              ]
            )
          ]
          right: <Id.KW_Done done>
        )
      redirects: []
    )
    (command.AndOr
      children: [
        (command.Simple
          blame_tok: <diff>
          more_env: []
          words: [{<diff>} {(DQ ($ Id.VSub_DollarName tmp1))} {(DQ ($ Id.VSub_DollarName tmp2))}]
          redirects: [
            (Redir op:<Id.Redir_Great '>'> loc:(redir_loc.Fd fd:1) arg:{<'/dev/null'>})
            (Redir op:<Id.Redir_GreatAnd '2>&'> loc:(redir_loc.Fd fd:2) arg:{<1>})
          ]
          do_fork: T
        )
        (command.Simple
          blame_tok: <err_exit>
          more_env: []
          words: [
            {<err_exit>}
            {
              (DQ <'files '> ($ Id.VSub_DollarName tmp1) <' and '> ($ Id.VSub_DollarName tmp2) 
                <' differ'>
              )
            }
          ]
          redirects: []
          do_fork: T
        )
      ]
      ops: [<Id.Op_DPipe _>]
    )
    (command.ControlFlow
      keyword: <Id.ControlFlow_Exit exit>
      arg_word: 
        {
          (word_part.ArithSub
            left: <Id.Left_DollarDParen '$(('>
            anode: 
              (arith_expr.TernaryOp
                cond: 
                  (arith_expr.Binary
                    op_id: Id.Arith_Less
                    left: ($ Id.Lit_ArithVarLike Errors)
                    right: {<Id.Lit_Digits 125>}
                  )
                true_expr: ($ Id.Lit_ArithVarLike Errors)
                false_expr: {<Id.Lit_Digits 125>}
              )
            right: <Id.Right_DollarDParen _>
          )
        }
    )
  ]
)