日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > linux >内容正文

linux

测试过程中常用的linux命令之【查找指定的文件内容】

發布時間:2023/12/20 linux 38 豆豆
生活随笔 收集整理的這篇文章主要介紹了 测试过程中常用的linux命令之【查找指定的文件内容】 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

????之前遇到過這種情況,在查看日志定位問題時,會將log 傳輸到本地,然后用本地的文本編輯工具打開文件,然后查找關鍵字,再進行分析。 這樣做無疑會降低效率。

整理了幾個常用的命令,可以進行快速的查找。


測試文件:

文件名稱為execution.log, 文件內容如下:

[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 was 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() {

需求:查找Timed關鍵字的信息


grep方法

grep -i Timed execution.log ?# -i,忽略大小寫


grep -e .*ime execution.log ? #-e, 支持正則表達式


vi方法

/str,正向查找,自頂向下的查找;

?str,反向查找,自底向上的查找。

點擊n,查找下次出現的位置;點擊N,查找上一次出現的位置

轉載于:https://blog.51cto.com/2338053/1978623

總結

以上是生活随笔為你收集整理的测试过程中常用的linux命令之【查找指定的文件内容】的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。