Search code examples
xcodebashshellxcodebuild

How do I ignore all output of a bash command until a given marker


I am running an xcodebuild command:

xcodebuild -workspace MyWorkspace.xcworkspace \
           -scheme "$XCODE_SCHEME_NAME" \
           -archivePath $ARCHIVE_PATH \
           -destination "$TEST_DESTINATION_DEVICE" \
           test

This produces lots of un-intesting output which I can filter using something similar to this answer xcodebuild | egrep -A 5 "(error|warning):"

However, I am interested in all of the test output. The test output comes after this line:

Test Suite 'All tests' started at 2014-09-29 14:04:54 +0000

So Is there a way to grep or filter everything after the above line? Preferable so that the error warning filter is preserved, i.e. Show the line if:

  • Either the line contains "error" or "warning"
  • Or the line is after the 'Test Suite * started at*' line

Solution

  • Another choice:

    xcodebuild ... | sed '1,/^Test Suite/d'