• sed是流编辑器,每一次读取一行到内存中,即称之为模式空间(pattern space)
  • 默认不修改原文件,如果需要修改需加-i参数
  • sed有模式空间及保持空间(hold sapce),默认打印模式空间中的内容到标准输出
  • sed读取每行的时候会将内容保存至内存中
  • 支持正则和扩展正则表达式,除-y选项

  • 命令行格式:将包含sed的命令写在命令行中执行
  • $ sed [options] 'command' files

[Options]:

  • -n : 与p(print)命令合用时,表示只显示被选中的行,而不是显示所有的行,然后被选中的行会显示两次。
  • -e : 可以指定多个command
  • -f FILE : FILE中每行是一个操作命令
  • -r : 支持扩展正则表达式
  • -i : 与p(print)命令合用时,表示只显示被选中的行,而不是显示所有的行,然后被选中的行会显示两次。

行定位:

  • n;    选中1行,n表示行号
  • /pattern/  使用正则表达式,注意要包含在/..../之间
[root@localhost test]# #打印第5行
[root@localhost test]# sed -n "5 p" data.txt
Maecheal    男  30  Washington      America[root@localhost test]# #打印匹配"China"的记录
[root@localhost test]# sed -n "/china/ p" data.txt
[root@localhost test]# sed -n "/China/ p" data.txt
小红        女  20  BeiJing         China
小明        男  22  ChongQing       China
花花        女  30  HeBei           China

选择多行,同样有两种方式:

  • n;    选中1行,n表示行号
  • /pattern/  使用正则表达式,注意要包含在/..../之间
[root@localhost test]# #打印第5行
[root@localhost test]# sed -n "5 p" data.txt
Maecheal    男  30  Washington      America[root@localhost test]# #打印匹配"China"的记录
[root@localhost test]# sed -n "/china/ p" data.txt
[root@localhost test]# sed -n "/China/ p" data.txt
小红        女  20  BeiJing         China
小明        男  22  ChongQing       China
花花        女  30  HeBei           China

选择多行,行与行之间

  • x,y;    选中行号在x~y之间的行
  • /pattern1/, /pattern2/    选择匹配两个正则表达式之间的行
[root@localhost test]# #打印第3~6行
[root@localhost test]# cat -n data.txt | sed -n "3,6 p"3  花花        女  30  HeBei           China4  Jane        女  29  Los Angeles     America5  Maecheal    男  30  Washington      America6  山本        男  25  Nagasaki        Japan[root@localhost test]# #打印“Jane”的行,到“贝爷”之间的行
[root@localhost test]# sed -n "/Jane/, /贝爷/ p" data.txt
Jane        女  29  Los Angeles     America
Maecheal    男  30  Washington      America
山本        男  25  Nagasaki        Japan
村上春树    男  40  Hiroshima       Japan
贝爷        男  35  Paris           Franch

不选择某一行或者某几行

  • 在后面加 ! 即可
[root@localhost test]# #打印除了第4行以外的所有行
[root@localhost test]# cat -n data.txt | sed -n "4! p"1  小红        女  20  BeiJing         China2  小明        男  22  ChongQing       China3  花花        女  30  HeBei           China5  Maecheal    男  30  Washington      America6  山本        男  25  Nagasaki        Japan7  村上春树    男  40  Hiroshima       Japan8  贝爷        男  35  Paris           Franch[root@localhost test]# #打印除3-7行之外的行
[root@localhost test]# cat -n data.txt | sed -n "3,7! p"1 小红        女  20  BeiJing         China2  小明        男  22  ChongQing       China8  贝爷        男  35  Paris           Franch

间隔几行选择

  • 使用x~y格式,首先打印第x行,然后每个y行,就打印一次
[root@localhost test]# #打印第3行,之后,每隔2行,就打印一次
[root@localhost test]# cat -n data.txt | sed -n "3~2 p"3  花花        女  30  HeBei           China5  Maecheal    男  30  Washington      America7  村上春树    男  40  Hiroshima       Japan

sed有几个基本的操作命令,分别是下面几个:

  • -a (append,添加,在行后追加)
  • -i(insert,插入,在行前插入)
  • -d(delete,删除行)
  • -c(chage,替换)
  • -s(subsitute,替换)

-a 增加行

[root@localhost test]# #在第3行后面增加一行“---------------”
[root@localhost test]# cat -n data.txt | sed "3a -------------"1  小红        女  20  BeiJing         China2  小明        男  22  ChongQing       China3  花花        女  30  HeBei           China
-------------4  Jane        女  29  Los Angeles     America5  Maecheal    男  30  Washington      America6  山本        男  25  Nagasaki        Japan7  村上春树    男  40  Hiroshima       Japan8  贝爷        男  35  Paris           Franch[root@localhost test]# #在3~5行的每一行后面加一行“==========”
[root@localhost test]# cat -n data.txt | sed "3,5a =========="1  小红        女  20  BeiJing         China2  小明        男  22  ChongQing       China3  花花        女  30  HeBei           China
==========4  Jane        女  29  Los Angeles     America
==========5  Maecheal    男  30  Washington      America
==========6  山本        男  25  Nagasaki        Japan7  村上春树    男  40  Hiroshima       Japan8  贝爷        男  35  Paris           Franch[root@localhost test]# #在每一行后面增加一行“===========”
[root@localhost test]# cat -n data.txt | sed "a =========="1  小红        女  20  BeiJing         China
==========2  小明        男  22  ChongQing       China
==========3  花花        女  30  HeBei           China
==========4  Jane        女  29  Los Angeles     America
==========5  Maecheal    男  30  Washington      America
==========6  山本        男  25  Nagasaki        Japan
==========7  村上春树    男  40  Hiroshima       Japan
==========8  贝爷        男  35  Paris           Franch
==========[root@localhost test]# #在行末增加一行“-------------------”
[root@localhost test]# sed '$a -------------------------' data.txt
小红        女  20  BeiJing         China
小明        男  22  ChongQing       China
花花        女  30  HeBei           China
Jane        女  29  Los Angeles     America
Maecheal    男  30  Washington      America
山本        男  25  Nagasaki        Japan
村上春树    男  40  Hiroshima       Japan
贝爷        男  35  Paris           Franch

-i 插入行

  • -i插入行和增加行的操作一样,区别是a是在行之后增加,i是在行之前插入
[root@localhost test]# #在第3行之前增加一行“---------------”
[root@localhost test]# cat -n data.txt | sed "3i --------------"1  小红        女  20  BeiJing         China2  小明        男  22  ChongQing       China
--------------3  花花        女  30  HeBei           China4  Jane        女  29  Los Angeles     America5  Maecheal    男  30  Washington      America6  山本        男  25  Nagasaki        Japan7  村上春树    男  40  Hiroshima       Japan8  贝爷        男  35  Paris           Franch[root@localhost test]# #在第3~5行的每一行之前插入一行"==========="
[root@localhost test]# cat -n data.txt | sed "3,5i ==========="1  小红        女  20  BeiJing         China2  小明        男  22  ChongQing       China
===========3  花花        女  30  HeBei           China
===========4  Jane        女  29  Los Angeles     America
===========5  Maecheal    男  30  Washington      America6  山本        男  25  Nagasaki        Japan7  村上春树    男  40  Hiroshima       Japan8  贝爷        男  35  Paris           Franch
[root@localhost test]# #在每一行之前插入一行"==========="
[root@localhost test]# cat -n data.txt | sed "i ==========="
===========1  小红        女  20  BeiJing         China
===========2  小明        男  22  ChongQing       China
===========3  花花        女  30  HeBei           China
===========4  Jane        女  29  Los Angeles     America
===========5  Maecheal    男  30  Washington      America
===========6  山本        男  25  Nagasaki        Japan
===========7  村上春树    男  40  Hiroshima       Japan
===========8  贝爷        男  35  Paris           Franch

-c 替换行

  • 替换行,是指,将指定行,整行内容都替换为指定内容,注意-s是指替换行中的一部分内容。
  • 注意,区间替换的时候,是整体替换,而不是逐行替换。
[root@localhost test]# #将第2行替换为"hello shell"
[root@localhost test]# cat -n data.txt | sed "2c hello world"1  小红        女  20  BeiJing         China
hello world3  花花        女  30  HeBei           China4  Jane        女  29  Los Angeles     America5  Maecheal    男  30  Washington      America6  山本        男  25  Nagasaki        Japan7  村上春树    男  40  Hiroshima       Japan8  贝爷        男  35  Paris           Franch[root@localhost test]# #尝试将第2~5行的每一行都替换为"hello world",但是实际操作后会将2-5行整体替换
[root@localhost test]# cat -n data.txt | sed "2,5c hello world"1  小红        女  20  BeiJing         China
hello world6  山本        男  25  Nagasaki        Japan7  村上春树    男  40  Hiroshima       Japan8  贝爷        男  35  Paris           Franch[root@localhost test]# #将每一行都替换为“hello world”
[root@localhost test]# cat -n data.txt | sed "c hello world"
hello world
hello world
hello world
hello world
hello world
hello world
hello world
hello world

-d 删除行

[root@localhost test]# #删除第4行
[root@localhost test]# cat -n data.txt | sed "4d"1  小红        女  20  BeiJing         China2  小明        男  22  ChongQing       China3  花花        女  30  HeBei           China5  Maecheal    男  30  Washington      America6  山本        男  25  Nagasaki        Japan7  村上春树    男  40  Hiroshima       Japan8  贝爷        男  35  Paris           Franch[root@localhost test]# #删除第4-6行
[root@localhost test]# cat -n data.txt | sed "4,6d"1  小红        女  20  BeiJing         China2  小明        男  22  ChongQing       China3  花花        女  30  HeBei           China7  村上春树    男  40  Hiroshima       Japan8  贝爷        男  35  Paris           Franch[root@localhost test]# #删除所有行(无意义)
[root@localhost test]# cat -n data.txt | sed "d"

-s 替换行的部分内容

[root@localhost test]# #将字符a替换为X
[root@localhost test]# sed 's/a/X/' data.txt
小红        女  20  BeiJing         ChinX
小明        男  22  ChongQing       ChinX
花花        女  30  HeBei           ChinX
JXne        女  29  Los Angeles     America
MXecheal    男  30  Washington      America
山本        男  25  NXgasaki        Japan
村上春树    男  40  HiroshimX       Japan
贝爷        男  35  PXris           Franch
  • 注意,在替换的时候,只替换了一次,即只替换第一个匹配的内容。如果要将满足条件的内容都替换,就需要加上g
[root@localhost test]# sed 's/a/X/g' data.txt
小红        女  20  BeiJing         ChinX
小明        男  22  ChongQing       ChinX
花花        女  30  HeBei           ChinX
JXne        女  29  Los Angeles     AmericX
MXecheXl    男  30  WXshington      AmericX
山本        男  25  NXgXsXki        JXpXn
村上春树    男  40  HiroshimX       JXpXn
贝爷        男  35  PXris           FrXnch

sed使用案例

1、在data文件的第8行下面增加一行“hello world”,并且hello world前面要有4个空格

[root@localhost test]# #测试1,直接输入4个空格,失败
[root@localhost test]# sed '8 a     hello world' data.txt
小红        女  20  BeiJing         China
小明        男  22  ChongQing       China
花花        女  30  HeBei           China
Jane        女  29  Los Angeles     America
Maecheal    男  30  Washington      America
山本        男  25  Nagasaki        Japan
村上春树    男  40  Hiroshima       Japan
贝爷        男  35  Paris           Franch
hello world[root@localhost test]# #测试2,使用反斜线转义,成功
[root@localhost test]# sed '8 a \    hello world' data.txt
小红        女  20  BeiJing         China
小明        男  22  ChongQing       China
花花        女  30  HeBei           China
Jane        女  29  Los Angeles     America
Maecheal    男  30  Washington      America
山本        男  25  Nagasaki        Japan
村上春树    男  40  Hiroshima       Japan
贝爷        男  35  Paris           Franchhello world

2、删除demo.txt文件中的空行

[root@localhost test]# cat demo.txt
11111122222333333
44444
[root@localhost test]# sed '/^$/ d' demo.txt
111111
22222
333333
44444

3、获取eth0网卡的ip

[root@localhost test]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0C:29:21:0C:0Finet addr:192.168.228.153  Bcast:192.168.228.255  Mask:255.255.255.0inet6 addr: fe80::20c:29ff:fe21:c0f/64 Scope:LinkUP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1RX packets:27644 errors:0 dropped:0 overruns:0 frame:0TX packets:14175 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:22947297 (21.8 MiB)  TX bytes:1135056 (1.0 MiB)[root@localhost test]# ifconfig eth0 | sed -n '/inet addr:/ p'inet addr:192.168.228.153  Bcast:192.168.228.255  Mask:255.255.255.0[root@localhost test]# ifconfig eth0 | sed -n '/inet addr:/ p' | sed 's/.*inet addr://'
192.168.228.153  Bcast:192.168.228.255  Mask:255.255.255.0[root@localhost test]# ifconfig eth0 | sed -n '/inet addr:/ p' | sed 's/.*inet addr://' | sed 's/B.*$//'
192.168.228.153

高级sed操作

使用花括号{   }将多个sed命令包含在一起,多个sed之间用;分开

[root@localhost test]# cat -n data.txt1  小红        女  20  BeiJing         China2  小明        男  22  ChongQing       China3  花花        女  30  HeBei           China4  Jane        女  29  Los Angeles     America5  Maecheal    男  30  Washington      America6  山本        男  25  Nagasaki        Japan7  村上春树    男  40  Hiroshima       Japan8  贝爷        男  35  Paris           Franch
[root@localhost test]# cat -n data.txt | sed '{3,5 d; s/China/Chinese/}'1  小红        女  20  BeiJing         Chinese2  小明        男  22  ChongQing       Chinese6  山本        男  25  Nagasaki        Japan7  村上春树    男  40  Hiroshima       Japan8  贝爷        男  35  Paris           Franch

打印奇数行和偶数行

[root@localhost test]# #打印奇数行
[root@localhost test]# cat -n data.txt | sed -n '1~2 p'1  小红        女  20  BeiJing         China3  花花        女  30  HeBei           China5  Maecheal    男  30  Washington      America7  村上春树    男  40  Hiroshima       Japan
[root@localhost test]# cat -n data.txt | sed -n '{p; n}'1  小红        女  20  BeiJing         China3  花花        女  30  HeBei           China5  Maecheal    男  30  Washington      America7  村上春树    男  40  Hiroshima       Japan
[root@localhost test]#
[root@localhost test]# #打印偶数行
[root@localhost test]# cat -n data.txt | sed -n '2~2 p'2  小明        男  22  ChongQing       China4  Jane        女  29  Los Angeles     America6  山本        男  25  Nagasaki        Japan8  贝爷        男  35  Paris           Franch
[root@localhost test]# cat -n data.txt | sed -n '{n; p}'2  小明        男  22  ChongQing       China4  Jane        女  29  Los Angeles     America6  山本        男  25  Nagasaki        Japan8  贝爷        男  35  Paris           Franch

&表示前面已经匹配的字符串内容,反向引用,不用再写一次正则表达式

  • 在男或者女之前加一个gender单词
[root@localhost test]# cat -n data.txt | sed 's/[男|女]/gender:[男|女]/'1  小红        gender:[男|女]  20  BeiJing         China2  小明        gender:[男|女]  22  ChongQing       China3  花花        gender:[男|女]  30  HeBei           China4  Jane        gender:[男|女]  29  Los Angeles     America5  Maecheal    gender:[男|女]  30  Washington      America6  山本        gender:[男|女]  25  Nagasaki        Japan7  村上春树    gender:[男|女]  40  Hiroshima       Japan8  贝爷        gender:[男|女]  35  Paris           Franch
[root@localhost test]# cat -n data.txt | sed 's/[男|女]/gender:&/'1  小红        gender:女  20  BeiJing         China2  小明        gender:男  22  ChongQing       China3  花花        gender:女  30  HeBei           China4  Jane        gender:女  29  Los Angeles     America5  Maecheal    gender:男  30  Washington      America6  山本        gender:男  25  Nagasaki        Japan7  村上春树    gender:男  40  Hiroshima       Japan8  贝爷        gender:男  35  Paris           Franch

  • 案例1:将data.txt中的所有字母都变为大写
[root@localhost test]# cat -n data.txt1  小红        女  20  BeiJing         China2  小明        男  22  ChongQing       China3  花花        女  30  HeBei           China4  Jane        女  29  Los Angeles     America5  Maecheal    男  30  Washington      America6  山本        男  25  Nagasaki        Japan7  村上春树    男  40  Hiroshima       Japan8  贝爷        男  35  Paris           Franch
[root@localhost test]# cat -n data.txt | sed 's/[A-Z]/\l&/g'1  小红        女  20  beijing         china2  小明        男  22  chongqing       china3  花花        女  30  hebei           china4  jane        女  29  los angeles     america5  maecheal    男  30  washington      america6  山本        男  25  nagasaki        japan7  村上春树    男  40  hiroshima       japan8  贝爷        男  35  paris           franch
[root@localhost test]# cat -n data.txt | sed 's/[a-z]/\u&/g'1  小红        女  20  BEIJING         CHINA2  小明        男  22  CHONGQING       CHINA3  花花        女  30  HEBEI           CHINA4  JANE        女  29  LOS ANGELES     AMERICA5  MAECHEAL    男  30  WASHINGTON      AMERICA6  山本        男  25  NAGASAKI        JAPAN7  村上春树    男  40  HIROSHIMA       JAPAN8  贝爷        男  35  PARIS           FRANCH

-r 复制指定文件插入到匹配行

  • 将A.txt中的内容,插入到B.txt的第2行后面
[root@localhost test]# #将A.txt中的内容插入到B.txt中的第2行后面
[root@localhost test]# sed '2 r A.txt' B.txt
AAAAAAA
BBBBBBB
111111
222222
333333
CCCCCCC
[root@localhost test]# #将A.txt中的内容插入到B.txt中包含CCCCCC的行后面
[root@localhost test]# sed '/CCCCCC/ r A.txt' B.txt
AAAAAAA
BBBBBBB
CCCCCCC
111111
222222
333333
[root@localhost test]# #将A.txt中的内容插入B.txt中每一行的后面
[root@localhost test]# sed 'r A.txt' B.txt
AAAAAAA
111111
222222
333333
BBBBBBB
111111
222222
333333
CCCCCCC
111111
222222
333333

-w 复制匹配行,拷贝到指定文件中

  • 对于A.txt中选中的行,保存到文件B.txt中,会首先清空B.txt的内容,然后将选中的行拷贝出来,再保存到B.txt中。
[root@localhost test]# #将A.txt中的2-4行,写到C.txt中,注意会先清空C.txt
[root@localhost test]# sed '2,4 w C.txt' A.txt
111111
222222
333333
[root@localhost test]# cat C.txt
222222
333333

-q 提前退出sed

  • sed的处理流程是:从文件中读入一行,然后sed处理一行,一直到文件结束为止。
  • 使用q,可以让sed提前结束,不用读到文件结束。
[root@localhost test]# #打印前3行
[root@localhost test]# sed '3 q' data.txt
小红        女  20  BeiJing         China
小明        男  22  ChongQing       China
花花        女  30  HeBei           China
[root@localhost test]#
[root@localhost test]# #找到第1个Japan
[root@localhost test]# sed '/Japan/ q' data.txt
小红        女  20  BeiJing         China
小明        男  22  ChongQing       China
花花        女  30  HeBei           China
Jane        女  29  Los Angeles     America
Maecheal    男  30  Washington      America
山本        男  25  Nagasaki        Japan

\(  \)多次反向引用

  • 使用\1,\2,\3....\n表示前面的第n个子表达式
  • 获取所有用户,以及用户的UID和GID
[root@localhost test]# head -5 /etc/passwd
root:x:0:0:root:/root:/bin/bash
bin:x:1:1:bin:/bin:/sbin/nologin
daemon:x:2:2:daemon:/sbin:/sbin/nologin
adm:x:3:4:adm:/var/adm:/sbin/nologin
lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin
[root@localhost test]# head -5 /etc/passwd | sed 's/^\([a-zA-Z_-]\+\):x:\([0-9]\+\):\([0-9]\+\):.*/USER:\1 \t UID:\2  GID:\3/'
USER:root        UID:0  GID:0
USER:bin         UID:1  GID:1
USER:daemon      UID:2  GID:2
USER:adm         UID:3  GID:4
USER:lp          UID:4  GID:7
  • 获取eth0的ip地址
[root@localhost test]# ifconfig eth0
eth0      Link encap:Ethernet  HWaddr 00:0C:29:21:0C:0Finet addr:192.168.228.153  Bcast:192.168.228.255  Mask:255.255.255.0inet6 addr: fe80::20c:29ff:fe21:c0f/64 Scope:LinkUP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1RX packets:34864 errors:0 dropped:0 overruns:0 frame:0TX packets:17848 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:23505959 (22.4 MiB)  TX bytes:1547380 (1.4 MiB)[root@localhost test]# ifconfig eth0 | sed -n '/inet addr/ p' | sed 's/.*inet addr:\([0-9.]\+\).*/\1/'
192.168.228.153

总结

指定单个文件查找

  • 方法一:cat test.log | grep “关键字”
  • 方法二:grep -i “关键字” ./test.log

查找指定时间段的日志

  • sed -n ‘/2020-01-01 13:10:10.294/, /2020-01-01 14:10:10.294/p’ test.log

关键字搜索指定时间段的日志

  • sed -n ‘/2020-01-01 13:10:10.294/, /2020-01-01 14:10:10.294/p’ test.log | grep “关键字”

如果想直接修改源文件,而没有这样的过程,可以用下面的命令

  • sed  -i 's/properties/property/g'  build.xml

02--Linux的sed使用相关推荐

  1. linux shell sed awk 命令(2)-awk

    linux shell sed awk 命令(2)-awk awk语法格式: awk [选项] -f program-file [ -- ] file ... 选项: -F fs, --field-s ...

  2. linux中往sed命令,Linux中Sed命令怎么用?

    Linux中Sed命令怎么用? 发布时间:2020-05-26 17:14:39 来源:亿速云 阅读:245 作者:鸽子 Sed介绍:sed是文本处理工具,读取文本内容,根据指定的条件进行处理如删除. ...

  3. Linux下sed命令替换配置文件中某个变量的值(改变包含字符的一行的值)之二——只改变第一出现的那一行

    一.背景 在之前的文章中有介绍过<Linux下sed命令替换配置文件中某个变量的值(改变包含字符的一行的值)> 但是这种方法存在一定的问题,就是假如某个变量在一个文件中出现两次,却只想更改 ...

  4. sed是linux命令吗,Linux命令 sed

    一. 以行为单位进行操作. d:删除 $ nl passwd | sed '2,5d'  # 删除第2~5行 $ nl passwd | sed '2d'  # 删除第2行 $ nl passwd | ...

  5. 批量修改linux换行格式,linux中sed命令批量修改

    sed命令下批量替换文件内容 格式: sed -i "s/查找字段/替换字段/g" `grep 查找字段 -rl 路径` 文件名 -i 表示inplace edit,就地修改文件 ...

  6. linux中sed和find,Linux运维知识之Linux 之 sed 与 find 命令结合使用

    本文主要向大家介绍了Linux运维知识之Linux 之 sed 与 find 命令结合使用,通过具体的内容向大家展现,希望对大家学习Linux运维知识有所帮助. sed 与 find 命令结合使用 目 ...

  7. linux 的sed命令解释 sed ':t;N;s/\n/,/;b t' 将换行符换成逗号

    linux 的sed命令解释 sed ':t;N;s/\n/,/;b t' 将换行符换成逗号 实现的功能是吧换行符换成逗号了,自己试验过. 求解释,:t N b t 都是什么意思??? :t 定义la ...

  8. linux sed替换文件,linux的sed命令替换文件

    linux下的sed是一个强大的编辑器工具,下面由学习啦小编为大家整理了linux的sed命令替换文件的相关知识,希望对大家有帮助! linux的sed命令替换文件 sed在Linux下是个强大的工具 ...

  9. Linux 使用 sed 整行(列)刪除

    Linux 使用 sed 整行(列)刪除 Posted on  2009 年 03 月 26 日  by  Tsung 垂直刪除有 Vim, cut 和 awk 可以用, 橫列刪除的倒是比較少用, 可 ...

  10. 【Linux脚本-sed命令在文本首行和尾行插入空行】

    @[TOC]Linux脚本-sed命令在文本首行和尾行插入空行 Linux脚本-sed命令在文本首行和尾行插入空行 演示如下: 首先创建需要操作的文本文件 //create a file contai ...

最新文章

  1. SwipeRefreshLayout 报错 dispatchTouchEvent
  2. MongoDB的学习--聚合
  3. Qt Designer信号和槽
  4. 浏览器工作原理(四):浏览器事件解读
  5. 大象喝水(信息学奥赛一本通-T1032)
  6. 程序员 论坛 linux,用了五年Linux,三分钟带你揭开Linux过程内幕
  7. 关于 django 的时区设置与MySQL 时间相差8小时
  8. gateway nacos注册服务_使用Nacos作为微服务注册中心和配置中心
  9. 在 windows 上安装免安装版的mysql
  10. ubuntu 18.04安装php 7,如何在Ubuntu 18.04和16.04上安装PHP(7.3,7.2和7.0)?
  11. 当Python中混进一只薛定谔的猫……
  12. 计算机电缆静电,ZR-DJFPVP计算机电缆
  13. Depth Map Prediction from a Single Image using a Multi-Scale Deep Network
  14. 利用opencv对图像进行二值化处理
  15. 怎样把word文档里的html格式去掉,word文档去除格式
  16. 10个小窍门,让你轻松准确搜索(转)
  17. pycharm更换国内源
  18. Unity3D空战游戏模板 Air Warfare Pro
  19. RedMonk最新编程语言排行榜;Spring 框架现 RCE 漏洞……|叨资讯
  20. pip安装命令大全(持续更新)

热门文章

  1. VR虚拟现实场景制作公司
  2. 为什么玩VR眼镜会头晕?
  3. Python 中 MNE 读取EEG竞赛数据绘图和提取epoch(gdf格式)
  4. python爬淘宝app数据_一篇文章教会你用Python爬取淘宝评论数据(写在记事本)
  5. 计算机水平要空着吗,计算机等级考试一级考试练习题
  6. Gpu-exporter部署手册
  7. 一文搞定驱动签名流程(Win10)
  8. 如何快速制作脚本?间隔时间自动使用按键精灵游戏技能辅助脚本
  9. 【目标检测】DetectoRS
  10. Regression testing minimization, selection and prioritization: a survey