#!/usr/bin/env python3
# Copyright (c) 2008 Arastra, Inc.  All rights reserved.
# Arastra, Inc. Confidential and Proprietary.

import sys, re

if len( sys.argv ) > 1:
   # pylint: disable-next=redefined-builtin
   filter = '^' + ' '.join( sys.argv[ 1 : ] ) + '$'
else:
   filter = '.*'

matchedCmd = False
while True:
   line = sys.stdin.readline()
   if not line:
      break
   if matchedCmd:
      if line.startswith( '   ' ):
         print( line, end=' ' )
         continue
   m = re.search( filter, line.lower() )
   matchedCmd = (m is not None)
   if matchedCmd:
      print( line, end=' ' )


      
