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

news2025/4/22 1:09:38

目录

基础正则表达式

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.coloradmin.cn/o/2339769.html

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

相关文章

05-DevOps-Jenkins自动拉取构建代码

新建Gitlab仓库 先在Gitab上创建一个代码仓库&#xff0c;选择创建空白项目 安装说明进行填写&#xff0c;然后点击创建项目 创建好的仓库是空的&#xff0c;什么都没有 新建一个springboot项目&#xff0c;用于代码上传使用。 只是为了测试代码上传功能&#xff0c;所以代码…

SRS transcode支持 h264_nvenc 硬件解码方案

文章目录 SRS transcode支持 h264_nvenc 硬件解码方案1、修改文件2、重新编译3、使用 SRS transcode支持 h264_nvenc 硬件解码方案 SRS 是开源的流媒体服务&#xff0c;但在使用 GPU 服务器时&#xff0c;想要通过硬件加速&#xff0c;目前官方是不支持的&#xff0c;所以简单…

阿里云服务器搭建开源版禅道

一&#xff0c;下载地址&#xff1a;禅道11.5版本发布&#xff0c;主要完善细节&#xff0c;修复bug&#xff0c;新增动态过滤机制 - 禅道下载 - 禅道项目管理软件 下载地址二&#xff1a; 禅道21.6.stable 实现旧编辑器撰写的文档无感升级至新版编辑器 - 禅道下载 - 禅道项目…

怎么用面向对象和状态机架构,设计一个通用的按键检测功能?

说起按键检测&#xff0c;在座的各位&#xff0c;哪个没被它折磨过&#xff1f; 我刚入门时&#xff0c;为了实现一个简单的按键功能&#xff0c;硬生生写了几十行代码&#xff0c;各种 if...else 嵌套&#xff0c;逻辑绕得我自己都头晕。 更可气的是&#xff0c;辛辛苦苦写完…

Java基础系列-LinkedList源码解析

文章目录 简介LinkedList 插入和删除元素的时间复杂度&#xff1f;LinkedList 为什么不能实现 RandomAccess 接口&#xff1f; LinkedList 源码分析Node 定义初始化获取元素插入元素删除元素遍历链表 简介 LinkedList 是一个基于双向链表实现的集合类&#xff0c;经常被拿来和…

qwen 14B模型配置文件,层名称weight_map. 28GB

qwen 14B模型配置文件,层名称weight_map. 28GB 目录 qwen 14B模型配置文件,层名称weight_map. 28GBmetadata(元数据)weight_map(权重映射)lm_head.weightmodel.layersmlp.{proj_type}.weightpost_attention_layernormself_attn.{proj_type}.{bias_or_weight}model.norm.w…

LVDS系列8:Xilinx 7系可编程输入延迟(一)

在解析LVDS信号时&#xff0c;十分重要的一环就是LVDS输入信号线在经过PCB输入到FPGA中后&#xff0c;本来该严格对齐的信号线会出现时延&#xff0c;所以需要在FPGA内部对其进行延时对齐后再进行解析。 Xilinx 7系器件中用于输入信号延时的组件为IDELAYE2可编程原语&#xff0…

【Oracle专栏】函数中SQL拼接参数 报错处理

Oracle相关文档,希望互相学习,共同进步 风123456789~-CSDN博客 1.背景 最近同事反馈了一个很奇怪的问题,即有一个函数,入参是当前年月,主要作用是通过SQL语句将不合规的数据插入到指定表中,插入数据时带上入参的年月参数。当前问题:单独测试SQL没有问题可以执行成功,…

自然语言处理(NLP)领域大图

以下是一份自然语言处理&#xff08;NLP&#xff09;与大模型领域的领域大图&#xff0c;涵盖技术框架、发展脉络、交叉融合点和应用场景的完整解析&#xff1a; 1. 核心技术体系 基础分析层级 词法分析&#xff1a;分词、词性标注、命名实体识别句法分析&#xff1a;依存句法…

【Linux我做主】GDB调试工具完全指南

Linux下GDB调试工具完全指南&#xff1a;25个核心命令详解与实战示例 github地址 有梦想的电信狗 前言 GDB&#xff08;GNU Debugger&#xff09;是Linux开发中不可或缺的调试工具&#xff0c;尤其在定位代码逻辑错误和内存问题时表现卓越。本文基于实际开发经验&#xff0…

Pycharm 如何删除某个 Python Interpreter

在PyCharm中&#xff0c;点击右下角的“Interpreter Settings”按钮&#xff0c;或者通过菜单栏选择“File” > “Settings”&#xff08;macOS用户选择“PyCharm” > “Preferences”&#xff09;。在设置窗口中&#xff0c;导航到“Project: [Your Project Name]” >…

Day3:个人中心页面布局前端项目uniapp壁纸实战

接下来我们来弄一下个人中心页面布局user.vue <template><view class"userLayout"><view class"userInfo"><view class"avatar"><image src"../../static/Kx.jpg" mode"aspectFill"></im…

正则表达式反向引用的综合应用魔法:从重复文本到简洁表达的蜕变

“我....我要....学学学学....编程 java!” —— 这类“重复唠叨”的文本是否让你在清洗数据时头疼不已&#xff1f; 本文将带你一步步掌握正则表达式中的反向引用技术&#xff0c;并结合 Java 实现一个中文文本去重与清洗的实用工具。 结合经典的结巴实例。如何高效地将这样的…

FFmpeg+Nginx+VLC打造M3U8直播

一、视频直播的技术原理和架构方案 直播模型一般包括三个模块&#xff1a;主播方、服务器端和播放端 主播放创造视频&#xff0c;加美颜、水印、特效、采集后推送给直播服务器 播放端&#xff1a; 直播服务器端&#xff1a;收集主播端的视频推流&#xff0c;将其放大后推送给…

Windows串口通信

Windows串口通信相比较Android串口通信,在开发上面相对方便一些。原理都是一样,需要仔细阅读厂商设备的串口通信协议。结合串口调试助手进行测试,测试通过后,编写代码实现。 比如近期就接触到了一款天平,其最大测量值为100g,测量精度0.001g。 拿到手之后我就先阅读串口通…

【开源项目】Excel手撕AI算法深入理解(三):时序(RNN、mamba、Long Short Term Memory (LSTM)、xLSTM)

项目源码地址&#xff1a;https://github.com/ImagineAILab/ai-by-hand-excel.git 一、RNN 1. RNN 的核心思想 RNN 的设计初衷是处理序列数据&#xff08;如时间序列、文本、语音&#xff09;&#xff0c;其核心特点是&#xff1a; 隐藏状态&#xff08;Hidden State&#xff…

构建专业金融图表系统的高效路径——QtitanChart在金融行业的应用价值

QtitanChart是一个C 库&#xff0c;它代表一组控件&#xff0c;这些控件使您可以快速轻松地为应用程序提供漂亮而丰富的图表。QtitanChart在Qt.C 上实现&#xff0c;并且支持所有主要的桌面操作系统 - Windows、Linux和Mac OSX。要将QtitanChart添加到您的程序中&#xff0c;只…

多模态大语言模型arxiv论文略读(二十六)

Holistic Autonomous Driving Understanding by Bird’s-Eye-View Injected Multi-Modal Large Models ➡️ 论文标题&#xff1a;Holistic Autonomous Driving Understanding by Bird’s-Eye-View Injected Multi-Modal Large Models ➡️ 论文作者&#xff1a;Xinpeng Ding,…

Java虚拟机(JVM)平台无关?相关?

计算机的概念模型 计算机实际上就是实现了一个图灵机模型。即&#xff0c;输入参数&#xff0c;根据程序计算&#xff0c;输出结果。图灵机模型如图。 Tape是输入数据&#xff0c;Program是针对这些数据进行计算的程序&#xff0c;中间横着的方块表示的是机器的状态。 目前使…

cloudstudio学习笔记之openwebui

代码获取 git clone 参考资料 openwebui官网 https://docs.openwebui.com/getting-started/advanced-topics/development 后端启动 cd backend pip install -r requirements.txt -U sh dev.sh后端启动成功后的界面 在cloudstudio提供的vscode弹出的提示中打开浏览器并在末…