Linux——Shell编程之正则表达式与文本处理器(笔记)

目录

基础正则表达式

1:基础正则表达式示例

(4)查找任意一个字符“.”与重新字符“*”

(5)查找连续字符范围“{ }”

文本处理器

一、sed工具

二、awk工具

(1)按行输出文本

(2)按字段输出文本

(3)通过管道、双引号调用 she11 命令


基础正则表达式

1:基础正则表达式示例

    下面的操作需要提前准备一个名为 test.txt 的测试文件,文件具体内容如下所示:

[root@localhost ~]# cat test.txt
he was short and fat, He was wearing a blue polo shirt with black pants. The home
of Football on BBc Sport online.
the tongue is boneless but it breaks bones.12!google is the best tools for search keyword, The year ahead will test our politicalestablishment to the limit. P3 141592653589793238462643383249901429a wood cross!
Actions speak louder than words
#N0ood #
#N000o0ood #
Axyzxуzxyzxy2C
I bet this place is really spooky late at night!
Misfortunes never come alone/single.
I shouldn't have lett so tast.

(1)查找特定字符

[root@localhost w]# grep -n"the" test.txt
4:the tongue is boneless but it breaks bones.12!
5:google is the best tools for search keyword, 6:The year ahead will test our politicalestablishment to the limit.
Iroot@localhost w]# grep in "the' test.txt
3:The home of Football on 8Bc Sport online. 4:the tongue is boneless but it breaks
bones.121
5:google is the best tools for search keyword, 6:The year ahead will test our political
establishment to the limit.
若反向选择,如查找不包含“the”字符的行,则需要通过 grep 命令的“-v"选项实现,并配合“-n”·起使用显示行号。
[rootglocalhost ~]# grep -vn "the' test.txt
1:he was short and fat, 2:He was wearing a blue polo shirt with black pants. 3:Thehome of football on BBc Sport online,7:P-3.1415926535897932384626433832499014298:a wood cross!
9:Actions speak louder than words
10:
11:#woood #
12:#wo0oo0o0d #
13:Axyzxyzxyzxy2C
14:I bet this place is really spooky late at night!
15:Misfortunes never come alone/single, 16:I shouldn't have lett so tast.

(2)利用中括号“[ ]”l来查找集合字符

[rootglocalhost ~]# grep -n 'sh[io]rt" test.txt1:he was short and fat, 2:He was wearing a blue polo shirt with black pants.
若要查找包含重复单个字符“oo"时,只需要执行以下命令即可
[rootglocalhost ~]# grep -n 'oo' test.txt
3:The home of Football on 8Bc Sport online, 5:google is the best tools for search
keyword. 8:a wood cross!
11:#woood #
12:#wo0oocood #
14:I bet this place is really spooky late at night!
若查找“oo”前面不是“w”的字符串,只需要通过集合字符的反向选择“[^]”来实现该目的。例如执行"grep -n'[^w]oo"test.txt"命令表示在 test.txt 文本中査找“oo"前面不是“w”的字符串。
[rootglocalhost ~]# grep -n'[^w]oo' test.txt3:The home of Football on BBc Sport online. 5:google is the best tools for searchkeyword. 11:#woood #
12:#wo0o00o0d #
14:I bet this place is really spooky late at night!
若查找“oo”前面不是“w”的字符串,只需要通过集合字符的反向选择“[^]”来实现该目的。例如执行“grep -n'[^w]oo"test.txt"命令表示在 test.txt 文本中査找“oo”前面不是“w”的字符串
[root@localhost ~]# grep -n'['w]oo' test.txt
3:The home of Football on BBc Sport online. 5:google is the best tools for searchkeyword, 11:#woood #
12:#ho0o00o0d #
14:I bet this place is really spooky late at night!
在上述命令的执行结果中发现“woood”与"woo0oood"也符合匹配规则,二者均包含“w”。其实通过执行结果就可以看出,符合匹配标准的字符加粗显示,而上还结果中可以得知。“#woood #”中加粗显示的是“o0o”,而“oo”前面的“o”是符合匹配规则的。同理“#woooo0ood #”也符合匹配规则。若不希望“oo”前而存在小写字母,可以使用“grep -n'[^a-z]oo'test.txt”命令实现,其中 a-z”表示小写字母,大写字母则通过“A-2”表示。
[rootglocalhost ~]# erep -n '[^a-z]oo" test.txt
3:The home of Football on BBc sport online.
查找包含数字的行可以通过“grep -n'[0-9]’test.txt”命令来实现。
[rootglocalhost ~]# grep -n '[8-9]" test.txt
4:the tongue is boneless but it breaks bones.12!
7:P1-3.141592653589793238462643383249901429

(3)查找行首“^”与行尾字符“$”

[root@localhost ~]# grep -n '^the' test.txt
4:the tongue is boneless but it breaks bones.12!
查询以小写字母开头的行可以通过“^[a-z]"规则来过滤,查询大写字母开头的行则使用“^[A-Z]“规若查询不以字母开头的行则使用“^[^a-zA-2]”规则。
[rootglocalhost ~]# grep -n '^[a-z]’ test.txt1:he was short and fat, 4:the tongue is boneless but it breaks bones.12!5:google is the best tools for search keyword, 8:a wood cross!
[root@localhost ~]# grep -n'^[A-2]' test.txt2:He was wearing a blue polo shirt with black pants, 3:The home of Football on 88CSport online. 6:The year ahead will test our political establishment to the limit.7:PI-3.1415926535897932384626433832499014299:Actions speak louder than words
13:AxyzxYzxy2xy2C
14:I bet this place is really spooky late at night!
15:Misfortunes never come alone/single. 16:I shouldn't have lett so tast.
[root@localhost ~]# grep -n'^[^a-zA-2]" test.txt
11:#woood #
12:#wo0o00o0d #
[root@localhost ~]# grep -n'.$"test.txt
1:he was short and fat, 2:He was wearing a blue polo shirt with black pants. 3:Thehome of Football on BBc Sport online. 5:google is the best tools for search keyword.6:The year ahead will test our political establishment to the limit. 15:Misfortunesnever come alone/single, 16:I shouldn't have lett so tast.
当查询空白行时,执行“grep -n'ns"test.txt”命令即可,
[root@localhost ~]# grep -n'^g'test.txt106
(4)查找任意一个字符“.”与重新字符“*”
[root@localhost ~]# grep -n 'w..d' test.txt5:google is the best tools for search keyword,8:a wood cross!
9:Actions speak louder than words
12:#wo0o0co0d #
14:I bet this place is really spooky late at night!
[rootglocalhost ~]# grep -n 'ooo*' test.txt3:The home of Football on BBc Sport online. 5:google is the best tools for searchkeyword, 8:a wood cross!
11:#wo00d #
12:#wo0oo0ood #
14:I bet this place is really spooky late at night!
查询以 w 开头 d结尾,中间包含至少一个 o 的字符串,执行以下命令即可实现。[rootglocalhost ~]# grep -n'woo*d" test.txt
8:a wood cross!
11:#woood #
12:#woooo0ood #
执行以下命令即可查询以 w开头 d 结尾,中间的字符可有可无的字符申,
[root@localhost ~]# erep -n 'w.*d' test.txt1:he was short and fat. 5:google is the best tools for search keyword. 8:a wood cross!9:Actions speak louder than words
11:#woood #
12:#wo0oocood #
执行以下命令即可查询任意数字所在行。
[rootglocalhost ~]# grep -n'[8-9][8-9].' test.txt4:the tongue is boneless but it breaks bones.12!
7:PI 3.141592653589793238462643383249901429

(5)查找连续字符范围“{ }”

查询两个0的字符,

[root@localhost ~]# grep -n'o{2}' test.txt
3:The home of football on BBc Sport online. 5:google is the best tools for searchkeyword. 8:a wood cross!
11:#wo0od #
12:#wo0000o0d #
14:I bet this place is really spooky late at night!


查询以 w 开头以 d 结尾,中间包含 2~5 个0的字符串,

[rootglocalhost ~]# grep -n 'wo'{2,5'}d" test.txt
B:a wood cross!
11:#wo0od #


查询以 w 开头以 d 结尾,中间包含 2个或 2 个以上0的字符串。
 

[rootglocalhost ~]# grep n 'woW2,\}d' test.txt
B:a wood cross!
11:#wo0od #
12:#wo000co0d #

元字符总结
字符说明
\将下一个字符标记为一个特殊字符、或一个原义字符、或一个向后引用、或一个八进制转义符;
^

匹配输入字符串的开始位置;

$匹配输入字符串的结束位置;
*匹配前面的子表达式零次或多次;
+匹配前面的子表达式一次或多次;
?匹配前面的子表达式零次或一次;
.

匹配除换行符( \n、\r )之外的任何单个字符;

[a-z]字符范围。匹配指定范围内的任意字符;
{n}

n是一个非负整数,匹配确定的n次;

{n,}

n是一个非负整数,至少匹配n次;

{n,m}

m和n均为非负整数,其中n<=m。最少匹配n次且最多匹配m次

\d

匹配一个数字字符。等价于【0~9】;

\D

匹配一个非数字字符。等价于【^0~9】;

\s

匹配任何空白字符,包括空格、制表符、换页符等等。等价于【^、\f、\n、\r、\t、\v】;

\S

匹配任何非空白字符。等价于【A~Z、a~z、0~9】;

\w匹配字母、数字、下划线。等价于`【A~Z、a~z、0~9、_】`;
\W匹配非字母、数字、下划线。等价于`【^A~Z、a~z、0~9、_】`;
\n匹配一个换行符
\f匹配一个换页符
\r匹配一个回车符

文本处理器

一、sed工具

   sed工具是一个强大而简单的文本解析转换工具,可以读取文本,并根据指定的条件对文本内容进行编辑(删除、替换、添加、移动等),最后输出所有行或者仅输出处理的某些行。

   它也可以在无交互的情况下实现相当复杂的文本处理操作,被广泛应用于 shel1 脚本中,用以完成各种自动化处理任务。工作流程主要包括读取、执行和显示三个过程。以下为详细介绍:

  • 读取:sed 从输入流(文件、管道、标准输入)中读取一行内容并存储到临时的缓冲区中。
  • 执行:默认情况下,所有的 sed 命令都在模式空间中顺序地执行,除非指定了行的地址,否则 sed命令将会在所有的行上依次执行。
  • 显示:发送修改后的内容到输出流。在发送数据后,模式空间将会被清空。

    格式如下: 

sed [选项] `操作` 参数
sed [选项] -f scriptfile 参数

    常见的 sed 命令选项主要包含以下几种:

  • -e或--expression=:表示用指定命令或者脚本来处理输入的文本文件
  • -f 或--file=:表示用指定的脚本文件来处理输入的文本文件。
  • -h或--help:显示帮助。
  • -n、--quiet 或 silent:表示仅显示处理后的结果。
  • -i:直接编辑文本文件。

     常见的操作包括以下几种:

  • a:增加,在当前行下面增加一行指定内容。
  • c:替换,将选定行替换为指定内容。
  • d:删除,删除选定的行。
  • i:插入,在选定行上面插入一行指定内容。
  • P:打印,如果同时指定行,表示打印指定行;如果不指定行,则表示打印所有内容;如果有非
  • 打印字符,则以 ASCII 码输出。其通常与“-n”选项一起使用。
  • s:替换,替换指定字符。
  • y:字符转换。

(1)输出符合条件的文本(p 表示正常输出)

[root@localhost ~]# sed -n 'p' test.txt
//输出所有内容,等同于 cat test.txt
he was short and fat, He was wearing a blue polo shirt with black pants. The homeof Footbal1on BBc sport online.
.….//省略部分内容
[root@localhost ~]# sed -n'3p' test.txt
//输出第 3 行
The home of Football on BBc Sport online.
[root@localhost ~]# sed -n '3,5p'test.txt//输出 3~5 行
The home of Football on BBc Sport online.the tongue is boneless but it breaks bones.12!google is the best tools for search keyword,
[root@localhost ~]# sed -n 'p;n' test.txt
//输出所有奇数行,n 表示读入下一行资料
he was short and fat, The home of football on BBc Sport online, google is the besttools for search keyword.…//省略部分内容
[root@localhost ~]# sed -n 'n;p' test.txt
//输出所有偶数行,n 表示读入下一行资料
He was wearing a blue polo shirt with black pants.
the tongue is boneless but it breaks bones.12!
The year ahead will test our political establishment to the limit.….//省略部分内容
[root@localhost ~]# sed -n'1,5{p;n}" test.txt//输出第 1~5 行之间的奇数行(第 1、3、 5 行)he was short and fat. The home of Football on BBc sport online, google is the besttools for search keyword.
[root@localhost ~]# sed -n'10,${n;p}' test.txt//输出第 18 行至文件尾之间的偶数行
#woood #
AxyzxуzxуzxyzC
Misfortunes never come alone/single.

(2)删除符合条件的文本

[root@localhost ~]# nl test.txt sed '3d'    //删除第 3 行
1 he was short and fat, 2 He was wearing a blue polo shirt with black pants. 4 thetongue is boneless but it breaks bones.12!
5 google is the best tools for search keyword. 6 The year ahead will test our politicalestablishment to the limit.…
//省略部分内容 
[root@localhost ~]# nl test.txt |sed '3,5d'
//删除第 3~5 行
1 he was short and fat, 2 He was wearing a blue polo shirt with black pants. 6 Theahead will test our politicalestablishment to the limit.yearPI 3.141592653589793238462643383249901429
8 a wood cross!...
//省略部分内容
[root@localhost ~]# nl test.txt sed '/cross/d'//删除包含 cross 的行,原本的第 8 行被删除;如果要删除不包含 cross 的行,用!符号表示取反操作,如'/cross/!d’…
//省略部分内容
7 PI-3.141592653589793238462643383249901429
9 Actions speak louder than words .
//省略部分内容
[root@localhost ~]# sed "/^[a-z]/d' test.txt
//删除以小写字母开头的行
He was wearing a blue polo shirt with black pants, The home of football on BBc Sportonline, The year ahead will test our political establishment to the limit.P-3.141592653589793238462643383249901429
Actions speak louder than words
#woood #
#w000o0ood #
Axyzxyzxyzxy2C
I bet this place is really spooky late at night!
Misfortunes never come alone/single.
I shouldn't have lett so tast.
[root@localhost ~]# sed "/\.$/d' test.txt
//删除以"."结尾的行
the tongue is boneless but it breaks bones.12!PI=3.141592653589793238462643383249901429
a wood cross!
Actions speak louder than words
#woood #
#wocoo0ood 并
AxyzxyzxyzxyzC
I bet this place is really spooky late at night!
[root@localhost ~]# sed "/^$/d' test.txt
//删除所有空行
he was short and fat, He was wearing a blue polo shirt with black pants. The homeof Football on BBc sport online.
the tongue is boneless but it breaks bones.12!google is the best tools for search keyword, The year ahead will test our politicalestablishment to the limit. p 3.141592653589793238462643383249901429
a wood cross!
Actions speak louder than words
#woood 并
#W000000od #
Axyzxyzxyzxy2C
I bet this place is really spooky late at night!
Misfortunes never come alone/single.
I shouldn't have lett so tast.

 (3)替换符合条件的文本

在使用 sed 命令进行替换操作时需要用到 s(字符申替换)、c(整行/整块营换)、y(字符转换)命令选项,常见的用法如下所示。
sed 's/the/THE/" test.txt
//将每行中的第一个 the 替换为 THE
sed 's/l/L/2'test.txt
//将绿行中的第 2 个 1 替换为L
sed 's/the/THE/g  test.txt
//将文件中的所有 the 普换为 THE
sed 's/o/'g' test.txt
//将文件中的所有 o 删除(替换为空申)
sed 's/^/#/' test.txt
//在绿行行首插入#号
sed '/the/s/^/#/' test.txt
//在包含 the 的每行行首插入#号
sed 's/$/E0F/" test.txt
//在每行行尾插入字符申EOF
sed '3,5s/the/THE/e' test.txt
//将第 3~5 行中的所有 the 替换为 THE
郑州课
sed '/the/s/o/o/g  test.txt
//将包含 the 的所有行中的 。 都普换为 0

(4)迁移符合条件的文本

在使用 sed 命令迁移符合条件的文本时,常用到以下参数:
> H:女制到剪贴板;
g、G:将剪贴板中的数据覆盖/追加至指定行:
w:保存为文件;
>r:读取指定文件;
a:追加指定内容。。
具体操作方法如下所示。
关
sed '/the/(H;d};$6' test.txt
//将包含 the 的行迁移至文件末尾,{;}用于多个操作
sed '1,5(H;d};176' test.txt
//将第 1~5 行内容转移至第 17 行后
sed '/the/w out.file" test.txt
//将包含 the 的行另存为文件 out.file
sed '/the'r /etc/hostname" test.txt
//将文件/etc/hostname 的内容添加到包含 the 的行以后
sed '3aNew" test.txt
//在第 3 行后插入一个新行,内容为 New
sed '/the/aNew' test.txt
//在包含 the 的每行后插入一个新行,内容为 Wew
sed '3aNewl\nNew2' test.txt
//在第 3 行后插入多行内容,中间的\n 表示换行

二、awk工具

    awk 是一种强大的‌文本处理工具‌,尤其适合处理结构化数据(如日志、CSV文件)。它不仅是命令行工具,还是一种编程语言,能够高效完成数据提取、统计、格式化输出等任务。通常情况下awk所使用的命令格式如下所示:

awk 选项 `模式或条件 {编辑命令}` 文件1 文件2 ...    //过滤并输出文件中符合条件的内容
awk -f 脚本文件 文件1 文件2 ...    //从脚本中调用编辑指令,过滤并输出内容

     其中,单引号加上大括号“{ }”用于设置对数据进行的处理动作。awk可以直接处理目标文件,也可以通过“ -f ”读取脚本对目标脚本进行处理。

特殊的内建变量(可直接使用),如下:

  • FS:指定每行文本的字段分隔符,默认为空格或制表位;
  • NF:当前处理的行的字段个数;
  • NR:当前处理的行的行数(序数);
  • $0:当前处理的行的整行的内容;
  • $n:当前处理的第n个字段(第n列);
  • FILENAME:被处理的文件名;
  • RS:数据记录分隔,默认为\n,即每行为一条记录。

    相对于sed命令,awk则倾向于将一行分成多个“字段” 然后再进行处理,且默认情况下字段的分隔符为空格或Tab键。而且其执行结果也可通过print的功能将字段数据打印显示。在使用awk命令的过程中,可以也使用逻辑操作符“&&”表示“与”、“ || ”表示“或”、“ !”表示“非”。范例如下:

[root@localhost ~]#awk -F ':' `{print $1,$3,$4}` /etc/passwd
root 0 0
bin 1 1
daemon 2 2
...    ...        //省略部分内容

    处理逻辑过程如下:

 用法示例:

(1)按行输出文本

按行输出文本
awk '{print}' test.txt
//输出所有内容,等同于 cat test.txt
awk '{print $o}' test.txt
//输出所有内容,等同于 cat test.txt
awk 'NR==1,NR==3fprint}' test.txt
//输出第 1~3 行内容
awk (NR>=1)&&(NR<=3){print}' test.txt//输出第 1~3 行内容
awk 'NR==1/|NR==3{print}" test.txt//输出第 1 行、第 3 行内容
awk "(NR%2)==1{print}'test.txt
//输出所有奇数行的内容
awk "(NR%2)==0{print}' test.txt
//输出所有偶数行的内容
awk "/^root/{print}'/etc/passwd
//输出以 root 开头的行

awk 'BEGIN {x=0};/\/bin\/bash$/{x++};END {print x}' /etc/passwd

//统计以/bin/bash 结尾的行数,等同于 grep-c"/bin/bash$"/etc/passwd
awk BEGIN{RS=""};END{print NR}" /etc/squid/squid.conf

//统计以空行分隔的文本段落数

(2)按字段输出文本

awk '{print $3}' test.txt
//输出每行中(以空格或制表位分隔)的第 3 个字段
awk '{print $1,$3}'test.txt
//输出每行中的第 1、3 个字段
awk -F ":"'$2==""{print}'/etc/shadow//输出密码为空的用户的 shadow 记录
aWk 'BEGIN {FS=":"};$2==""{print}' /etc/shadow//输出密码为空的用户的 shadow 记录
awk -F":"'$7~"/bash"{print $1}" /etc/passwd//输出以冒号分隔且第 7个字段中包含/bash 的行的第 1 个字段
awk '($1~"nfs")&&(NF==8){print $1,$2}' /etc/services//输出包含 8 个字段且第 1 个字段中包含 nfs 的行的第 1、2 个字段
awk -F":"'($7!="/bin/bash")&&($7!="/sbin/nologin"){print}' /etc/passwd//输出第7个字段既不为/bin/bash 也不为/sbin/nologin 的所有行 

(3)通过管道、双引号调用 she11 命令

awk -F:'/bash$/{print|"wc -l"}'/etc/passwd//调用 wc -1 命令统计使用 bash 的用户个数,等同于 grep -c"bash$"/etc/passwd
awk "BEGIN {while("w"|getline)n++ ;{print n-2}}//调用 w命令,并用来统计在线用户数
awk 'BEGIN("hostname"getline ; print $0}//调用 hostname,并输出当前的主机名

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/pingmian/77441.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

OpenHarmony系统-源码下载,环境搭建,编译,烧录,调试

获取源码 以OpenHarmony5.0.3为例 repo init -u https://gitee.com/openharmony/manifest -b OpenHarmony-5.0.3-Release --no-repo-verify repo sync -c repo forall -c git lfs pull搭建环境 安装必要的工具和命令 apt-get install -y apt-utils binutils bison flex bc …

Vue3 本地打包启动白屏解决思路!! !

“为什么我访问 http://127.0.0.1:5501/index.html 白屏&#xff0c;删了 index.html 再访问 / 就又活过来了&#xff1f;” —— 你的项目与 SPA 路由的“宫斗大戏” 一、问题复现 场景 本地通过 VSCode Live Server&#xff08;或其他静态服务器&#xff09;启动了打包后的 V…

数字人(2):数字人技术全景透视(2025演进版)

随着人工智能技术的迅猛发展,数字人技术发展也是一日千里。站在当下,着眼未来,我们一起在回眸透视过去的基础上,一起共同眺望数字人技术的未来。 一、数字人技术体系重构 我们可以用三维定义对数字人技术进行框架重构 维度 技术内涵 典型特征 物理层 人体数字化建模技术 …

小刚说C语言刷题——1035 判断成绩等级

1.题目描述 输入某学生成绩&#xff0c;如果 86分以上(包括 86分&#xff09;则输出 VERY GOOD &#xff0c;如果在 60到 85之间的则输出 GOOD (包括 60和 85)&#xff0c;小于 60 的则输出 BAD。 输入 输入只有一行&#xff0c;包括 1个整数。 输出 输出只有一行&#xf…

React-在使用map循环数组渲染列表时须指定唯一且稳定值的key

在渲染列表的时候&#xff0c;我们须给组件或者元素分配一个唯一值的key, key是一个特殊的属性&#xff0c;不会最终加在元素上面&#xff0c;也无法通过props.key来获取&#xff0c;仅在react内部使用。react中的key本质是服务于diff算法, 它的默认值是null, 在diff算法过程中…

Zookeeper的通知机制是什么?

大家好&#xff0c;我是锋哥。今天分享关于【Zookeeper的通知机制是什么&#xff1f;】面试题。希望对大家有帮助&#xff1b; Zookeeper的通知机制是什么&#xff1f; 1000道 互联网大厂Java工程师 精选面试题-Java资源分享网 Zookeeper 的通知机制是其核心特性之一&#xf…

【LangChain实战】构建下一代智能问答系统:从RAG架构到生产级优化

打破传统问答系统的次元壁 当ChatGPT在2022年掀起AI革命时&#xff0c;开发者们很快发现一个残酷现实&#xff1a;通用大模型在专业领域的表现如同拿着地图的盲人&#xff0c;既无法理解企业私有数据&#xff0c;也无法保证事实准确性。这催生了RAG&#xff08;检索增强生成&a…

UDS中功能寻址可以请求多帧数据嘛?当ECU响应首帧后,诊断仪是通过物理寻址发送流控帧嘛?

文章目录 1. 前言📢1.1 功能寻址是否支持请求多帧数据?1.2 ECU发送首帧(FF)后,诊断仪如何发送流控帧(FC)?1.3 协议依据(ISO 14229-1)1.4 实际应用注意事项总结1. 前言📢 在UDS(Unified Diagnostic Services)协议中,功能寻址与物理寻址的使用规则以及多帧数据传…

PHP异常处理__Throwable

在 PHP 里&#xff0c;Throwable 是一个极为关键的接口&#xff0c;自 PHP 7 起被引入。它为错误和异常处理构建了一个统一的框架。下面会详细介绍 Throwable 的相关内容。 1. 基本概念 Throwable 是 Exception 和 Error 的父接口。在 PHP 7 之前&#xff0c;异常&#xff08…

无需训练的具身导航探索!TRAVEL:零样本视觉语言导航中的检索与对齐

作者&#xff1a; Navid Rajabi, Jana Kosecka 单位&#xff1a;乔治梅森大学计算机科学系 论文标题&#xff1a;TRAVEL: Training-Free Retrieval and Alignment for Vision-and-Language Navigation 论文链接&#xff1a;https://arxiv.org/pdf/2502.07306 主要贡献 提出…

Vue3+Vite+TypeScript+Element Plus开发-22.客制Table组件

系列文档目录 Vue3ViteTypeScript安装 Element Plus安装与配置 主页设计与router配置 静态菜单设计 Pinia引入 Header响应式菜单缩展 Mockjs引用与Axios封装 登录设计 登录成功跳转主页 多用户动态加载菜单 Pinia持久化 动态路由 -动态增加路由 动态路由-动态删除…

Java读取JSON文件并将其中元素转为JSON对象输出

&#x1f91f;致敬读者 &#x1f7e9;感谢阅读&#x1f7e6;笑口常开&#x1f7ea;生日快乐⬛早点睡觉 &#x1f4d8;博主相关 &#x1f7e7;博主信息&#x1f7e8;博客首页&#x1f7eb;专栏推荐&#x1f7e5;活动信息 文章目录 Java读取JSON文件并将其中元素转为JSON对象输…

Spring Boot自动配置原理深度解析:从条件注解到spring.factories

大家好&#xff01;今天我们来深入探讨Spring Boot最神奇的特性之一——自动配置(Auto-configuration)。这个功能让Spring Boot如此受欢迎&#xff0c;因为它大大简化了我们的开发工作。让我们一起来揭开它的神秘面纱吧&#xff01;&#x1f440; &#x1f31f; 什么是自动配置…

【ELF2学习板】利用OpenMP采用多核并行技术提升FFTW的性能

目录 引言 OpenMP简介 编译OpenMP支持的FFTW库 部署与测试 测试程序 程序部署 测试结果 结语 引言 在前面已经介绍了在ELF2开发板上运行FFTW计算FFT。今天尝试利用RK3588的多核运算能力来加速FFT运算。FFTW利用多核能力可以考虑使用多线程或者OpenMP。今天介绍一下Ope…

2000-2017年各省城市天然气供气总量数据

2000-2017年各省城市天然气供气总量数据 1、时间&#xff1a;2000-2017年 2、来源&#xff1a;国家统计局、能源年鉴 3、指标&#xff1a;行政区划代码、城市、年份、城市天然气供气总量 4、范围&#xff1a;31省 5、指标说明&#xff1a;城市天然气供气总量是指在一定时间…

Hadoop的三大结构及其作用?

Hadoop是一个分布式存储和计算框架&#xff0c;其三大核心组件是HDFS&#xff08;Hadoop Distributed File System&#xff09;、YARN&#xff08;Yet Another Resource Negotiator&#xff09;和MapReduce。它们各自有着重要的作用&#xff0c;共同构成了Hadoop生态系统的基础…

【AI论文】ColorBench:视觉语言模型能否看到并理解多彩的世界?一个全面的色彩感知、推理和鲁棒性基准测试

摘要&#xff1a;颜色在人类感知中起着重要作用&#xff0c;通常在视觉推理中提供关键线索。 然而&#xff0c;尚不清楚视觉语言模型&#xff08;VLMs&#xff09;是否以及如何像人类一样感知、理解和利用颜色。 本文介绍了ColorBench&#xff0c;这是一个精心设计的创新基准&a…

Python番外——常用的包功能讲解和分类组合

目录 1. Web开发框架与工具 2. 数据处理与分析 3. 网络请求与爬虫 4. 异步编程 5. 数据库操作 6. 图像与多媒体处理 7. 语言模型与NLP 8. 安全与加密 9. 配置与工具 10. 其他工具库 11.典型组合场景 此章节主要是记录我所使用的包&#xff0c;以及模块。方便供自己方…

华硕原厂系统枪神9/9p超竟版-WIN11原装开箱出厂系统安装

华硕原厂系统枪神9/9p超竟版-WIN11-24H2-专业工作站版本安装可带F12-ASUSRecovery恢复功能 适用机型&#xff1a; G635LX、G635LW、G835LX、G835LW、G615LW、G615LP、G615LM、G615LH G815LW、G815LP、G815LM、G815LH、G635LR、G835LR、G615LR、G815LR 远程恢复安装&#xff…

拉取windows的docker镜像转到服务器上构建服务镜像

在windows上将拉取ubuntu的docker镜像转到服务器上 1.要求 1.1 要求windows和服务器安装好docker 2.拉取ubuntu镜像到windows&#xff08;dos操作&#xff0c;可能需要连接到外网&#xff09; 一旦你选择了一个合适的基础镜像&#xff0c;你可以使用docker pull命令从Docke…