linux打开car命令 linux cargo( 四 )


[root@www ~]#grep-n'[0-9][0-9]*' regular_express.txt5:However, this dress is about $3183 dollars.15:You are the best is mean you are the no.1.
限定连续 RE 字符范围 {}
我们可以利用 . 与 RE 字符及 * 来配置 0 个到无限多个重复字节 ,  那如果我想要限制一个范围区间内的重复字节数呢?
举例来说,我想要找出两个到五个 o 的连续字串,该如何作?这时候就得要使用到限定范围的字符 {} 了 。但因为 { 与 } 的符号在 shell 是有特殊意义的,因此, 我们必须要使用字符\ 来让他失去特殊意义才行 。至於 {} 的语法是这样的,假设我要找到两个 o 的字串,可以是:
[root@www ~]#grep-n'o\{2\}' regular_express.txt1:"Open Source" is a good mechanism to develop programs.2:apple is my favorite food.3:Football game is not use feet only.9:Oh! The soup taste good.18:google is the best toolsfor search ke19:goooooogle yes!
假设我们要找出 g 后面接 2 到 5 个 o ,然后再接一个 g 的字串,他会是这样:
[root@www ~]#grep-n'go\{2,5\}g' regular_express.txt18:google is the best toolsforsearch keyword.
如果我想要的是 2 个 o 以上的 goooo....g 呢?除了可以是 gooo*g,也可以是:
[root@www ~]#grep-n'go\{2,\}g' regular_express.txt18:google is the best toolsfor search keyword.19:goooooogle yes!
扩展grep(grep -E 或者 egrep):
使用扩展grep的主要好处是增加了额外的正则表达式元字符集 。
打印所有包含NW或EA的行 。如果不是使用egrep,而是grep , 将不会有结果查出 。
#egrep'NW|EA' testfile
northwestNWCharles Main3.0.98334easternEATB Savage4.4.84520
对于标准grep , 如果在扩展元字符前面加\,grep会自动启用扩展选项-E 。
#grep'NW\|EA' testfile
northwestNWCharles Main3.0.98334easternEATB Savage4.4.84520
搜索所有包含一个或多个3的行 。
#egrep'3+' testfile
# grep-E'3+' testfile
# grep'3\+' testfile
#这3条命令将会
northwestNWCharles Main3.0.98334westernWESharon Gray5.3.97523northeastNEAM Main Jr.5.1.94313centralCTAnn Stephens5.7.94513
搜索所有包含0个或1个小数点字符的行 。
#egrep'2\.?[0-9]' testfile
# grep-E'2\.?[0-9]' testfile
# grep'2\.\?[0-9]' testfile
#首先含有2字符,其后紧跟着0个或1个点,后面再是0和9之间的数字 。
westernWESharon Gray5.3.97523southwestSWLewis Dalsass2.7.8218easternEATB Savage4.4.84520
搜索一个或者多个连续的no的行 。
#egrep'(no)+' testfile
# grep-E'(no)+' testfile
# grep'\(no\)\+' testfile#3个命令返回相同结果,
northwestNWCharles Main3.0.98334northeastNEAM Main Jr.5.1.94313northNOMargot Weber4.5.8959
不使用正则表达式
fgrep 查询速度比grep命令快 , 但是不够灵活:它只能找固定的文本,而不是规则表达式 。
如果你想在一个文件或者输出中找到包含星号字符的行
fgrep'*' /etc/profile
for i in /etc/profile.d/*.sh ; do

grep -F '*' /etc/profile
for i in /etc/profile.d/*.sh ; do
将Python程序打包成linux可执行文件1.安装环境
首先我们要安装pip,命令如下:
使用的工具是 pyinstaller ,打开终端输入sudo pip install pyinstaller
2.打包程序
首先在打包之前检查一下我们的py文件是否可以正常执行,确认无误后进行打包 pyinstaller -F car_tkinter.py或者 python3 -m PyInstaller -F main.py
3.执行文件
进入我们打包存放的文件夹 , 打开终端,执行语句 ./car_tkinter或者 nohup./car_tkinter data.log
LINUX基本操作1.你必须是超级用户登录才有权利,命令不记得了 。不过你可以直接在/etc/passwd下面找到所有的用户名,至于密码,你是看不到的 。不过你可以修改 。只是linux的安全策略 。

推荐阅读