mardi 23 août 2016

How to save bash output in text/excel file?

I want to save the particular result to the text/excel file through bash. I tried below command it works fine, but I need only last result passed/failed, not the each step of execution.

I used below command to execute

$ bash eg.sh Behatscripts.txt > output.xls or
$ bash eg.sh Behatscripts.txt > output.txt

Below is the output console in my case, this whole thing is writing into the .txt/.xls file. But I need only last part that is:

    1 scenario (1 passed)
    3 steps (3 passed)

Executing the Script : eg.feature
----------------------------------------
@javascript
Feature: home page Validation
  In order to check the home page of our site
  As a website/normal user
  I should be able to find some of the links/texts on the home page

  Scenario: Validate the links in the header and footer # features\cap_english_home.feature:8
    Given I am on the homepage                          # FeatureContext::iAmOnHomepage()
    When I visit "/en"                                  # FeatureContext::assertVisit()
    Then I should see the following <links>             # FeatureContext::iShouldSeeTheFollowingLinks()
      | links                        |
      | Dutch                        |

1 scenario (1 passed)
3 steps (3 passed)
0m14.744s

Give some suggestion to put condition to save only last part of the output console, thanks in advance.

Aucun commentaire:

Enregistrer un commentaire