(command.CommandList
  children: [
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:context)
          op: assign_op.Equal
          rhs: {(0)}
          spids: [8]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:esc)
          op: assign_op.Equal
          rhs: {(DQ ('^['))}
          spids: [11]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:boldon)
          op: assign_op.Equal
          rhs: {(DQ (${ Id.VSub_Name esc) ('[1m'))}
          spids: [16]
        )
        (assign_pair
          lhs: (sh_lhs_expr.Name name:boldoff)
          op: assign_op.Equal
          rhs: {(DQ (${ Id.VSub_Name esc) ('[22m'))}
          spids: [24]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:sedscript)
          op: assign_op.Equal
          rhs: {(DQ (/tmp/cgrep.sed.) ($ Id.VSub_Dollar '$$'))}
          spids: [32]
        )
      ]
    )
    (command.ShAssignment
      pairs: [
        (assign_pair
          lhs: (sh_lhs_expr.Name name:tempout)
          op: assign_op.Equal
          rhs: {(DQ (/tmp/cgrep.) ($ Id.VSub_Dollar '$$'))}
          spids: [38]
        )
      ]
    )
    (command.ShFunction
      name: showMatches
      body: 
        (command.BraceGroup
          children: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:matches)
                  op: assign_op.Equal
                  rhs: {(0)}
                  spids: [52]
                )
              ]
            )
            (command.Simple
              words: [
                {(echo)}
                {
                  (DQ (s/) ($ Id.VSub_DollarName '$pattern') (/) (${ Id.VSub_Name boldon) 
                    ($ Id.VSub_DollarName '$pattern') (${ Id.VSub_Name boldoff) (/g)
                  )
                }
              ]
              redirects: [
                (redir.Redir
                  op: (Token id:Id.Redir_Great val:'>' span_id:73)
                  fd: -1
                  arg_word: {($ Id.VSub_DollarName '$sedscript')}
                )
              ]
            )
            (command.ForEach
              iter_name: lineno
              iter_words: [
                {
                  (command_sub
                    left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:85)
                    command_list: 
                      (command.CommandList
                        children: [
                          (command.Pipeline
                            children: [
                              (C {(grep)} {(-n)} {(DQ ($ Id.VSub_DollarName '$pattern'))} 
                                {($ Id.VSub_Number '$1')}
                              )
                              (C {(cut)} {(-d) (Id.Lit_Other ':')} {(-f1)})
                            ]
                            negated: F
                          )
                        ]
                      )
                  )
                }
              ]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: [
                            (command.Sentence
                              child: 
                                (C {(Id.Lit_LBracket '[')} {($ Id.VSub_DollarName '$context')} {(-gt)} 
                                  {(0)} {(Id.Lit_RBracket ']')}
                                )
                              terminator: (Token id:Id.Op_Semi val:';' span_id:123)
                            )
                          ]
                          action: [
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:prev)
                                  op: assign_op.Equal
                                  rhs: 
                                    {
                                      (DQ 
                                        (word_part.ArithSub
                                          anode: 
                                            (arith_expr.Binary
                                              op_id: Id.Arith_Minus
                                              left: 
                                                (arith_expr.ArithWord
                                                  w: {($ Id.VSub_DollarName '$lineno')}
                                                )
                                              right: 
                                                (arith_expr.ArithWord
                                                  w: {($ Id.VSub_DollarName '$context')}
                                                )
                                            )
                                        )
                                      )
                                    }
                                  spids: [128]
                                )
                              ]
                            )
                            (command.If
                              arms: [
                                (if_arm
                                  cond: [
                                    (command.Sentence
                                      child: 
                                        (C {(Id.Lit_LBracket '[')} {($ Id.VSub_DollarName '$prev')} 
                                          {(-lt)} {(1)} {(Id.Lit_RBracket ']')}
                                        )
                                      terminator: (Token id:Id.Op_Semi val:';' span_id:157)
                                    )
                                  ]
                                  action: [
                                    (command.ShAssignment
                                      pairs: [
                                        (assign_pair
                                          lhs: (sh_lhs_expr.Name name:prev)
                                          op: assign_op.Equal
                                          rhs: {(DQ (1))}
                                          spids: [166]
                                        )
                                      ]
                                    )
                                  ]
                                  spids: [145 159]
                                )
                              ]
                            )
                            (command.ShAssignment
                              pairs: [
                                (assign_pair
                                  lhs: (sh_lhs_expr.Name name:next)
                                  op: assign_op.Equal
                                  rhs: 
                                    {
                                      (DQ 
                                        (word_part.ArithSub
                                          anode: 
                                            (arith_expr.Binary
                                              op_id: Id.Arith_Plus
                                              left: 
                                                (arith_expr.ArithWord
                                                  w: {($ Id.VSub_DollarName '$lineno')}
                                                )
                                              right: 
                                                (arith_expr.ArithWord
                                                  w: {($ Id.VSub_DollarName '$context')}
                                                )
                                            )
                                        )
                                      )
                                    }
                                  spids: [175]
                                )
                              ]
                            )
                            (command.If
                              arms: [
                                (if_arm
                                  cond: [
                                    (command.Sentence
                                      child: 
                                        (C {(Id.Lit_LBracket '[')} {($ Id.VSub_DollarName '$matches')} 
                                          {(-gt)} {(0)} {(Id.Lit_RBracket ']')}
                                        )
                                      terminator: (Token id:Id.Op_Semi val:';' span_id:203)
                                    )
                                  ]
                                  action: [
                                    (command.Simple
                                      words: [
                                        {(echo)}
                                        {
                                          (DQ (${ Id.VSub_Name prev) (i) 
                                            (word_part.EscapedLiteral
                                              token: 
                                                (Token
                                                  id: Id.Lit_EscapedChar
                                                  val: '\\\\'
                                                  span_id: 215
                                                )
                                            )
                                          )
                                        }
                                      ]
                                      redirects: [
                                        (redir.Redir
                                          op: (Token id:Id.Redir_DGreat val:'>>' span_id:218)
                                          fd: -1
                                          arg_word: {($ Id.VSub_DollarName '$sedscript')}
                                        )
                                      ]
                                    )
                                    (command.Simple
                                      words: [{(echo)} {(DQ (----))}]
                                      redirects: [
                                        (redir.Redir
                                          op: (Token id:Id.Redir_DGreat val:'>>' span_id:229)
                                          fd: -1
                                          arg_word: {($ Id.VSub_DollarName '$sedscript')}
                                        )
                                      ]
                                    )
                                  ]
                                  spids: [191 205]
                                )
                              ]
                            )
                            (command.Simple
                              words: [
                                {(echo)}
                                {(DQ (${ Id.VSub_Name prev) (',') (${ Id.VSub_Name next) (p))}
                              ]
                              redirects: [
                                (redir.Redir
                                  op: (Token id:Id.Redir_DGreat val:'>>' span_id:250)
                                  fd: -1
                                  arg_word: {($ Id.VSub_DollarName '$sedscript')}
                                )
                              ]
                            )
                          ]
                          spids: [111 125]
                        )
                      ]
                      else_action: [
                        (command.Simple
                          words: [{(echo)} {(DQ (${ Id.VSub_Name lineno) (p))}]
                          redirects: [
                            (redir.Redir
                              op: (Token id:Id.Redir_DGreat val:'>>' span_id:267)
                              fd: -1
                              arg_word: {($ Id.VSub_DollarName '$sedscript')}
                            )
                          ]
                        )
                      ]
                    )
                    (command.ShAssignment
                      pairs: [
                        (assign_pair
                          lhs: (sh_lhs_expr.Name name:matches)
                          op: assign_op.Equal
                          rhs: 
                            {
                              (DQ 
                                (word_part.ArithSub
                                  anode: 
                                    (arith_expr.Binary
                                      op_id: Id.Arith_Plus
                                      left: 
                                        (arith_expr.ArithWord
                                          w: {($ Id.VSub_DollarName '$matches')}
                                        )
                                      right: (arith_expr.ArithWord w:{(Id.Lit_Digits 1)})
                                    )
                                )
                              )
                            }
                          spids: [275]
                        )
                      ]
                    )
                  ]
                )
            )
            (command.If
              arms: [
                (if_arm
                  cond: [
                    (command.Sentence
                      child: 
                        (C {(Id.Lit_LBracket '[')} {($ Id.VSub_DollarName '$matches')} {(-gt)} {(0)} 
                          {(Id.Lit_RBracket ']')}
                        )
                      terminator: (Token id:Id.Op_Semi val:';' span_id:306)
                    )
                  ]
                  action: [
                    (command.Pipeline
                      children: [
                        (C {(sed)} {(-n)} {(-f)} {($ Id.VSub_DollarName '$sedscript')} 
                          {($ Id.VSub_Number '$1')}
                        )
                        (C {(uniq)})
                        (C {(more)})
                      ]
                      negated: F
                    )
                  ]
                  spids: [294 308]
                )
              ]
            )
          ]
        )
    )
    (C {(trap)} 
      {
        (DQ 
          (command_sub
            left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:338)
            command_list: (command.CommandList children:[(C {(which)} {(rm)})])
          ) (' -f ') ($ Id.VSub_DollarName '$tempout') (' ') ($ Id.VSub_DollarName '$sedscript')
        )
      } {(EXIT)}
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Id.Lit_LBracket '[')} {(-z)} {(DQ ($ Id.VSub_Number '$1'))} {(Id.Lit_RBracket ']')})
              terminator: (Token id:Id.Op_Semi val:';' span_id:365)
            )
          ]
          action: [
            (command.Sentence
              child: 
                (command.Simple
                  words: [
                    {(echo)}
                    {(DQ ('Usage: ') ($ Id.VSub_Number '$0') (' [-c X] pattern {filename}'))}
                  ]
                  redirects: [
                    (redir.Redir
                      op: (Token id:Id.Redir_GreatAnd val:'>&' span_id:378)
                      fd: -1
                      arg_word: {(2)}
                    )
                  ]
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:380)
            )
            (command.ControlFlow
              token: (Token id:Id.ControlFlow_Exit val:exit span_id:382)
              arg_word: {(0)}
            )
          ]
          spids: [353 367]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Id.Lit_LBracket '[')} {(DQ ($ Id.VSub_Number '$1'))} {(Id.Lit_Equals '=')} 
                  {(DQ (-c))} {(Id.Lit_RBracket ']')}
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:405)
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:context)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number '$2'))}
                  spids: [410]
                )
              ]
            )
            (command.Sentence
              child: (C {(shift)})
              terminator: (Token id:Id.Op_Semi val:';' span_id:417)
            )
            (C {(shift)})
          ]
          spids: [389 407]
        )
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Id.Lit_LBracket '[')} 
                  {
                    (DQ 
                      (command_sub
                        left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:426)
                        command_list: 
                          (command.CommandList
                            children: [
                              (command.Pipeline
                                children: [(C {(echo)} {($ Id.VSub_Number '$1')}) (C {(cut)} {(-c1-2)})]
                                negated: F
                              )
                            ]
                          )
                      )
                    )
                  } {(Id.Lit_Equals '=')} {(DQ (-c))} {(Id.Lit_RBracket ']')}
                )
              terminator: (Token id:Id.Op_Semi val:';' span_id:445)
            )
          ]
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:context)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ 
                        (command_sub
                          left_token: (Token id:Id.Left_DollarParen val:'$(' span_id:452)
                          command_list: 
                            (command.CommandList
                              children: [
                                (command.Pipeline
                                  children: [(C {(echo)} {($ Id.VSub_Number '$1')}) (C {(cut)} {(-c3-)})]
                                  negated: F
                                )
                              ]
                            )
                        )
                      )
                    }
                  spids: [450]
                )
              ]
            )
            (C {(shift)})
          ]
          spids: [421 447]
        )
      ]
    )
    (command.CommandList
      children: [
        (command.Sentence
          child: 
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:pattern)
                  op: assign_op.Equal
                  rhs: {(DQ ($ Id.VSub_Number '$1'))}
                  spids: [471]
                )
              ]
            )
          terminator: (Token id:Id.Op_Semi val:';' span_id:475)
        )
        (C {(shift)})
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: [
            (command.Sentence
              child: 
                (C {(Id.Lit_LBracket '[')} {($ Id.VSub_Pound '$#')} {(-gt)} {(0)} {(Id.Lit_RBracket ']')})
              terminator: (Token id:Id.Op_Semi val:';' span_id:492)
            )
          ]
          action: [
            (command.ForEach
              iter_name: filename
              do_arg_iter: T
              body: 
                (command.DoGroup
                  children: [
                    (C {(echo)} {(DQ ('----- ') ($ Id.VSub_DollarName '$filename') (' -----'))})
                    (C {(showMatches)} {($ Id.VSub_DollarName '$filename')})
                  ]
                )
            )
          ]
          spids: [480 494]
        )
      ]
      else_action: [
        (command.Simple
          words: [{(cat)} {(-)}]
          redirects: [
            (redir.Redir
              op: (Token id:Id.Redir_Great val:'>' span_id:530)
              fd: -1
              arg_word: {($ Id.VSub_DollarName '$tempout')}
            )
          ]
        )
        (C {(showMatches)} {($ Id.VSub_DollarName '$tempout')})
      ]
    )
    (command.ControlFlow token:(Token id:Id.ControlFlow_Exit val:exit span_id:545) arg_word:{(0)})
  ]
)