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

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 综合教程 >内容正文

综合教程

grep/pgrep/egrep/fgrep

發布時間:2023/12/13 综合教程 35 生活家
生活随笔 收集整理的這篇文章主要介紹了 grep/pgrep/egrep/fgrep 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

Differences between grep, pgrep, egrep, and fgrep (Linux):

grep

grep is an acronym that stands for "Global Regular Expressions Print". grep is a program which scans a specified file or files line by line, returning lines that contain a pattern. A pattern is an expression that specifies a set of strings by interpreting characters as meta-characters. For example the asterisk meta character (*) is interpreted as meaning "zero or more of the preceding element". This enables users to type a short series of characters and meta characters into a grep command to have the computer show us what lines in which files match.

The standard grep command looks like:

grep <flags> '<regular expression>' <filename>

grep prints the search results to the screen (stdout) and returns the following exit values:

0    A match was found.
1    No match was found.
>1   A syntax error was found or a file was inaccessible 
     (even if matches were found).

Some common flags are:-cfor counting the number of successful matches and not printing the actual matches,-ito make the search case insensitive,-nto print the line number before each match printout,-vto take the complement of the regular expression (i.e. return the lines which don't match), and-lto print the file names of files with lines which match the expression.

egrep

egrep is an acronym that stands for "Extended Global Regular Expressions Print".

The 'E' in egrep means treat the pattern as a regular expression. "Extended Regular Expressions" abbreviated 'ERE' is enabled in egrep. egrep (which is the same asgrep -E) treats+,?,|,(, and)as meta-characters.

In basic regular expressions (with grep), the meta-characters?,+,{,|,(, and)lose their special meaning. If you want grep to treat these characters as meta-characters, escape them?,+,{,|,(, and).

For example, here grep uses basic regular expressions where the plus is treated literally, any line with a plus in it is returned.

grep "+" myfile.txt

egrep on the other hand treats the "+" as a meta character and returns every line because plus is interpreted as "one or more times".

egrep "+" myfile.txt

Here every line is returned because the+was treated by egrep as a meta character. normal grep would have searched only for lines with a literal+.

fgrep

fgrep is an acronym that stands for "Fixed-string Global Regular Expressions Print".

fgrep (which is the same as grep -F) is fixed or fast grep and behaves as grep but does NOT recognize any regular expression meta-characters as being special. The search will complete faster because it only processes a simple string rather than a complex pattern.

For example, if I wanted to search my .bash_profile for a literal dot (.) then using grep would be difficult because I would have to escape the dot because dot is a meta character that means 'wild-card, any single character':

grep "." myfile.txt

The above command returns every line of myfile.txt. Do this instead:

fgrep "." myfile.txt

Then only the lines that have a literal '.' in them are returned. fgrep helps us not bother escaping our meta characters.

pgrep

pgrep is an acronym that stands for "Process-ID Global Regular Expressions Print".

pgrep looks through the currently running processes and lists the process IDs which matches the selection criteria to stdout. pgrep is handy when all you want to know is the process id integer of a process. For example, if I wanted to know only the process ID of my mysql process I would use the commandpgrep mysqlwhich would return a process ID like 7312.

來自:http://superuser.com/questions/508881/what-is-the-difference-between-grep-pgrep-egrep-fgrep

總結

以上是生活随笔為你收集整理的grep/pgrep/egrep/fgrep的全部內容,希望文章能夠幫你解決所遇到的問題。

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

主站蜘蛛池模板: 一区二区三区免费看 | 亚洲无人禁区 | 无套内谢少妇毛片 | 性感少妇在线观看 | av激情久久| 成人av高清 | 国产伦精品一区二区三区妓女 | 在线看黄网 | 国产激情视频一区二区 | 国产高清www| 日韩一区二区三区四区在线 | 视频在线中文字幕 | 日本性高潮视频 | 国产精品91在线观看 | 日韩中文字幕网 | 麻豆国产精品一区 | 欧美激情18p| 久久人人爽人人爽人人片 | 亚洲人成人一区二区在线观看 | 乳罩脱了喂男人吃奶视频 | 日韩欧美精品在线播放 | 97caop| 91免费片| 乱图区 | 中文字幕码精品视频网站 | 韩国激情呻吟揉捏胸视频 | 尤物网站在线 | 久久久久99人妻一区二区三区 | 日本在线小视频 | 亚洲视频一二三区 | 美女屁股无遮挡 | 日本一区二区网站 | 欧美日韩国产免费一区二区三区 | 国产私人影院 | 欧美日韩成人免费 | 久久五月视频 | 亚洲91精品 | 一区二区三区精 | www.四虎在线 | 国产激情对白 | 九九精品在线视频 | 欧美日韩国产在线播放 | 国产精欧美一区二区三区白种人 | 色亚洲天堂 | 91视频地址 | 国产成人午夜精品无码区久久 | 国产精品电影一区 | 男女羞羞动态图 | 色窝窝综合色窝窝久久 | 麻豆免费在线 | 中文字幕av免费在线观看 | 在线观看国产一级片 | 中文字幕一本 | www网站在线免费观看 | 成人日韩精品 | 国产黄色的视频 | 小视频在线观看 | 青青草国产成人99久久 | 亚洲尤物在线 | 中文字幕av日韩 | 久久久久久国产精品一区 | 免费在线观看高清影视网站 | 亚洲永久无码精品一区二区 | 欧美三级a做爰在线观看 | 国产色 | 中文字幕激情小说 | 91视频分类 | 欧美国产日本在线 | 香蕉视频色版 | 国产一二区在线 | 丰满肥臀噗嗤啊x99av | 麻豆91在线播放 | www.97av.com| 国产一区二区视频在线免费观看 | 日产精品久久久久 | 麻豆国产尤物av尤物在线观看 | 九九热精品 | 日韩欧美在线视频播放 | h在线免费| 中国一级片在线观看 | 国产精品色 | 91在线色 | 爱视频福利网 | 人妻无码中文久久久久专区 | 日日摸夜夜添狠狠添久久精品成人 | 麻豆视频一区 | 国产一区不卡在线 | 超碰在线中文 | 日本美女在线 | 欧美国产91| 国产伦精品一区二区三区精品 | 国产一区二区三区高清视频 | 久久久青 | 日韩精品一二 | 国产精品自拍网 | 好大好舒服视频 | 国产精品久久久久久亚洲 | 色先锋av| 少妇人妻真实偷人精品视频 |