"Find specified file contents" in common Linux commands during testing

Source: Internet
Author: User

In this case, when viewing the log location issue, log is transferred locally, then open the file with the local text Editing tool, then look for the keyword and then analyze it. This will undoubtedly reduce efficiency.

Several commonly used commands are organized to make quick lookups.


Test file:

The file name is called Execution.log and the contents are as follows:

[ERROR] Timed out after 50000ms

[ERROR] Element css= #href_20_Id > Span.title not found

[ERROR] element css= #addUserBtn not found

[ERROR] element css=td[title= "13011094548"] Not found

[ERROR] element id=useridlist not found

[ERROR] element css=div.toast.toast-success not found

[ERROR] There is an unexpected alert! 

[ERROR] Element name=id[] not found

[ERROR] Element xpath=//table/tbody/tr/td[3] not found

[ERROR] Element css=div.toast-message not found

[ERROR] unexpected Exception: [Exception ... "Component returned failure code:0x80520012 (ns_error_file_not_found) [Nsifileoutputstream.init]"  nsresult: " 0x80520012 (Ns_error_file_not_found) " location:" JS frame:: chrome://selenium-ide/content/selenium-core/ Scripts/selenium-api.js:: Newfileoutputstream:: Line 3112 " data:no". ToString, Function tostring () {

Requirements: Find information for timed keywords


grep method

Grep-i Timed Execution.log #-I., ignoring case

650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/03/5461266c4365b94082acc50014e1d822.png "title=" Grepi ( 2). png "alt=" 5461266c4365b94082acc50014e1d822.png "/>


Grep-e. *ime Execution.log #-e, regular expressions supported

650) this.width=650; "src=" Https://s2.51cto.com/oss/201711/03/6cc7fa8b3209ae078a3bb0a075031334.png "title=" Grepe.png "alt=" 6cc7fa8b3209ae078a3bb0a075031334.png "/>


Vi method

/str, forward lookup, top-down lookup;

? STR, reverse lookup, bottom-up lookup.

Click N to find the next occurrence, and click N to find the last occurrence of the position.

650) this.width=650; "src=" Https://s4.51cto.com/oss/201711/03/87a83bc3570def607e6b2f93a456b3c0.png "title=" vi.png "alt=" 87a83bc3570def607e6b2f93a456b3c0.png "/>

This article is from the "Le Gakuen" blog, please be sure to keep this source http://2338053.blog.51cto.com/2328053/1978623

"Find specified file contents" in common Linux commands during testing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.