日韩性视频-久久久蜜桃-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的全部內容,希望文章能夠幫你解決所遇到的問題。

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

主站蜘蛛池模板: 99热播| 老熟女高潮一区二区三区 | 国模无码大尺度一区二区三区 | 美女一二三区 | 国产黄色免费网站 | 精品人妻人人做人人爽夜夜爽 | 欧美天堂一区 | 亚洲AV无码久久精品浪潮 | 九九热精品视频在线 | 国产免费麻豆 | av国产片| 爱爱一区二区三区 | 中文毛片无遮挡高潮免费 | 亚洲黄页网站 | 91性色| 91精品国产91久久久久福利 | 老鸭窝一区二区 | 视色av| 午夜免费小视频 | 日本激情视频网站 | 国产十八熟妇av成人一区 | 美女交配 | 日本一区二区高清不卡 | 国产婷婷一区二区 | 毛片视频网站在线观看 | 葵司有码中文字幕二三区 | 国产精品77| 国产视频1区2区3区 国产欧美一区二区精品性色99 | 亚洲综合欧美 | 尤物网站在线 | 爱射综合 | 久久久久久成人 | 日韩视频免费看 | 亚洲熟妇av一区二区三区 | 99久久夜色精品国产亚洲 | 一区二区三区波多野结衣 | 日本毛片在线 | 亚洲熟妇无码av在线播放 | 丁香婷婷社区 | www.97超碰 | 黑人一级大毛片 | 私拍在线 | 91在线免费观看网站 | 亚洲操操| 亚洲女人av| 国内一区二区三区 | 在线观看第一页 | 天堂俺去俺来也www久久婷婷 | 公交上高潮的丁芷晴 | 熟妇高潮一区二区高潮 | 51 吃瓜网 | 顶弄h校园1v1 | 国产精品熟女一区二区不卡 | 日本精品一区二区三区在线观看 | 欧美一区二区在线观看视频 | 啪视频在线 | 久久精品一二 | 免费黄色国产 | 国产一区二区网站 | 成人在线视频免费 | 法国伦理少妇愉情 | 淫语对白 | aaa一级黄色片 | 另类图片亚洲色图 | 北条麻妃一二三区 | 91成人免费电影 | 天堂在线一区二区 | 成人动漫一区二区 | 国产美女被草 | 亚洲综合色网站 | 日本三级韩国三级美三级91 | 国产精品久久在线观看 | 日韩精品片 | 情涩快播 | 亚洲成年网站 | 黄片毛片在线免费观看 | 少妇高潮视频 | 美女的奶胸大爽爽大片 | 99re这里只有精品在线观看 | 在线观看日韩 | 少妇精品久久久一区二区三区 | 秋霞无码一区二区 | 国产69精品久久久久久久 | 精品久久人妻av中文字幕 | 老外黄色一级片 | 久久草视频在线 | 成人精品视频99在线观看免费 | 亚洲视频观看 | 五月天激情啪啪 | 最新色站 | av资源天堂 | 久草视频精品在线 | 日韩爽爽视频 | 亚洲a网| 亚洲精品视频一区二区 | 午夜激情视频在线播放 | 村上里沙番号 | 午夜剧场91| 亚洲最大视频网站 |