(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: 
        (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
                  op: <Id.Redir_Great '>'>
                  loc: (redir_loc.Fd fd:1)
                  arg: {($ Id.VSub_DollarName '$sedscript')}
                )
              ]
              do_fork: T
            )
            (command.ForEach
              iter_name: lineno
              iter_words: [
                {
                  (command_sub
                    left_token: <Id.Left_DollarParen '$('>
                    child: 
                      (command.Pipeline
                        children: [
                          (C {<grep>} {<-n>} {(DQ ($ Id.VSub_DollarName '$pattern'))} 
                            {($ Id.VSub_Number '$1')}
                          )
                          (C {<cut>} {<-d> <Id.Lit_Colon ':'>} {<-f1>})
                        ]
                        negated: F
                      )
                  )
                }
              ]
              do_arg_iter: F
              body: 
                (command.DoGroup
                  children: [
                    (command.If
                      arms: [
                        (if_arm
                          cond: 
                            (condition.Shell
                              commands: [
                                (command.Sentence
                                  child: 
                                    (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$context')} 
                                      {<-gt>} {<0>} {<Id.Lit_RBracket ']'>}
                                    )
                                  terminator: <Id.Op_Semi _>
                                )
                              ]
                            )
                          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: {($ Id.VSub_DollarName '$lineno')}
                                              right: {($ Id.VSub_DollarName '$context')}
                                            )
                                        )
                                      )
                                    }
                                  spids: [128]
                                )
                              ]
                            )
                            (command.If
                              arms: [
                                (if_arm
                                  cond: 
                                    (condition.Shell
                                      commands: [
                                        (command.Sentence
                                          child: 
                                            (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$prev')} 
                                              {<-lt>} {<1>} {<Id.Lit_RBracket ']'>}
                                            )
                                          terminator: <Id.Op_Semi _>
                                        )
                                      ]
                                    )
                                  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: {($ Id.VSub_DollarName '$lineno')}
                                              right: {($ Id.VSub_DollarName '$context')}
                                            )
                                        )
                                      )
                                    }
                                  spids: [175]
                                )
                              ]
                            )
                            (command.If
                              arms: [
                                (if_arm
                                  cond: 
                                    (condition.Shell
                                      commands: [
                                        (command.Sentence
                                          child: 
                                            (C {<Id.Lit_LBracket '['>} 
                                              {($ Id.VSub_DollarName '$matches')} {<-gt>} {<0>} {<Id.Lit_RBracket ']'>}
                                            )
                                          terminator: <Id.Op_Semi _>
                                        )
                                      ]
                                    )
                                  action: [
                                    (command.Simple
                                      words: [
                                        {<echo>}
                                        {
                                          (DQ (${ Id.VSub_Name prev) <i> 
                                            (word_part.EscapedLiteral
                                              token: <Id.Lit_EscapedChar '\\\\'>
                                            )
                                          )
                                        }
                                      ]
                                      redirects: [
                                        (redir
                                          op: <Id.Redir_DGreat '>>'>
                                          loc: (redir_loc.Fd fd:1)
                                          arg: {($ Id.VSub_DollarName '$sedscript')}
                                        )
                                      ]
                                      do_fork: T
                                    )
                                    (command.Simple
                                      words: [{<echo>} {(DQ <---->)}]
                                      redirects: [
                                        (redir
                                          op: <Id.Redir_DGreat '>>'>
                                          loc: (redir_loc.Fd fd:1)
                                          arg: {($ Id.VSub_DollarName '$sedscript')}
                                        )
                                      ]
                                      do_fork: T
                                    )
                                  ]
                                  spids: [191 205]
                                )
                              ]
                            )
                            (command.Simple
                              words: [
                                {<echo>}
                                {(DQ (${ Id.VSub_Name prev) <','> (${ Id.VSub_Name next) <p>)}
                              ]
                              redirects: [
                                (redir
                                  op: <Id.Redir_DGreat '>>'>
                                  loc: (redir_loc.Fd fd:1)
                                  arg: {($ Id.VSub_DollarName '$sedscript')}
                                )
                              ]
                              do_fork: T
                            )
                          ]
                          spids: [111 125]
                        )
                      ]
                      else_action: [
                        (command.Simple
                          words: [{<echo>} {(DQ (${ Id.VSub_Name lineno) <p>)}]
                          redirects: [
                            (redir
                              op: <Id.Redir_DGreat '>>'>
                              loc: (redir_loc.Fd fd:1)
                              arg: {($ Id.VSub_DollarName '$sedscript')}
                            )
                          ]
                          do_fork: T
                        )
                      ]
                    )
                    (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: {($ Id.VSub_DollarName '$matches')}
                                      right: {<Id.Lit_Digits 1>}
                                    )
                                )
                              )
                            }
                          spids: [275]
                        )
                      ]
                    )
                  ]
                )
            )
            (command.If
              arms: [
                (if_arm
                  cond: 
                    (condition.Shell
                      commands: [
                        (command.Sentence
                          child: 
                            (C {<Id.Lit_LBracket '['>} {($ Id.VSub_DollarName '$matches')} {<-gt>} {<0>} 
                              {<Id.Lit_RBracket ']'>}
                            )
                          terminator: <Id.Op_Semi _>
                        )
                      ]
                    )
                  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:<Id.Left_DollarParen '$('> child:(C {<which>} {<rm>})) <' -f '> 
          ($ Id.VSub_DollarName '$tempout') <' '> ($ Id.VSub_DollarName '$sedscript')
        )
      } {<EXIT>}
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {<-z>} {(DQ ($ Id.VSub_Number '$1'))} 
                      {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.Sentence
              child: 
                (command.Simple
                  words: [
                    {<echo>}
                    {(DQ <'Usage: '> ($ Id.VSub_Number '$0') <' [-c X] pattern {filename}'>)}
                  ]
                  redirects: [(redir op:<Id.Redir_GreatAnd '>&'> loc:(redir_loc.Fd fd:1) arg:{<2>})]
                  do_fork: T
                )
              terminator: <Id.Op_Semi _>
            )
            (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
          ]
          spids: [353 367]
        )
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {(DQ ($ Id.VSub_Number '$1'))} {<Id.Lit_Equals '='>} 
                      {(DQ <-c>)} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          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:<Id.Op_Semi _>)
            (C {<shift>})
          ]
          spids: [389 407]
        )
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} 
                      {
                        (DQ 
                          (command_sub
                            left_token: <Id.Left_DollarParen '$('>
                            child: 
                              (command.Pipeline
                                children: [(C {<echo>} {($ Id.VSub_Number '$1')}) (C {<cut>} {<-c1-2>})]
                                negated: F
                              )
                          )
                        )
                      } {<Id.Lit_Equals '='>} {(DQ <-c>)} {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          action: [
            (command.ShAssignment
              pairs: [
                (assign_pair
                  lhs: (sh_lhs_expr.Name name:context)
                  op: assign_op.Equal
                  rhs: 
                    {
                      (DQ 
                        (command_sub
                          left_token: <Id.Left_DollarParen '$('>
                          child: 
                            (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: <Id.Op_Semi _>
        )
        (C {<shift>})
      ]
    )
    (command.If
      arms: [
        (if_arm
          cond: 
            (condition.Shell
              commands: [
                (command.Sentence
                  child: 
                    (C {<Id.Lit_LBracket '['>} {($ Id.VSub_Pound '$#')} {<-gt>} {<0>} 
                      {<Id.Lit_RBracket ']'>}
                    )
                  terminator: <Id.Op_Semi _>
                )
              ]
            )
          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
              op: <Id.Redir_Great '>'>
              loc: (redir_loc.Fd fd:1)
              arg: {($ Id.VSub_DollarName '$tempout')}
            )
          ]
          do_fork: T
        )
        (C {<showMatches>} {($ Id.VSub_DollarName '$tempout')})
      ]
    )
    (command.ControlFlow token:<Id.ControlFlow_Exit exit> arg_word:{<0>})
  ]
)