gerp 檢視字串

2021-09-26 04:32:42 字數 602 閱讀 9180

如果你想在當前目錄下 查詢"hello,world!"字串,可以這樣:

grep -rn 「hello,world!」 *

-r 是遞迴查詢

-n 是顯示行號

-r 查詢所有檔案包含子目錄

-i 忽略大小寫

下面是一些有意思的命令列引數:

grep -i pattern files :不區分大小寫地搜尋。預設情況區分大小寫,

grep -l pattern files :只列出匹配的檔名,

grep -l pattern files :列出不匹配的檔名,

grep -w pattern files :只匹配整個單詞,而不是字串的一部分(如匹配『magic』,而不是『magical』),

grep -c number pattern files :匹配的上下文分別顯示[number]行,

grep pattern1 | pattern2 files :顯示匹配 pattern1 或 pattern2 的行,

grep pattern1 files | grep pattern2 :顯示既匹配 pattern1 又匹配 pattern2 的行。

這裡還有些用於搜尋的特殊符號:

ORACLE in 字串,字串,字串

因為傳進來的引數是 字串,字串,字串,要實現in 字串,字串,字串 select from htl price p where p.hotel id 30073328 and p.able sale date between to date 2009 03 27 yyyy mm dd and to ...

gerp 1 查詢檔案中指定的字串,並列印該行

autho yj function like gerp command in linux find lines with a specified string in a file,and print these lines.usage grep string filename include inc...

字串,字串陣列,字串指標!!

字串 字元陣列實際上是一系列字元的集合,也就是 字串 string 字串陣列 在c語言中,沒有專門的字串變數,沒有string型別,通常就用乙個字元陣列來存放乙個字串。c語言規定,可以將字串直接賦值給字元陣列 在c語言中,字串總是以 0 作為串的結束符。上面的兩個字串,編譯器已經在末尾自動新增了 0...