当前位置: 首页 > news >正文

手机网站后台百度拍照搜题

手机网站后台,百度拍照搜题,自己做网站编程,沈阳开发网站公司哪家好0 前言 在 Linux shell编程学习笔记73:sed命令——沧海横流任我行(上)-CSDN博客文章浏览阅读684次,点赞32次,收藏24次。在大数据时代,我们要面对大量数据,有时需要对数据进行替换、删除、新增、…

 

0 前言

 在

Linux shell编程学习笔记73:sed命令——沧海横流任我行(上)-CSDN博客文章浏览阅读684次,点赞32次,收藏24次。在大数据时代,我们要面对大量数据,有时需要对数据进行替换、删除、新增、选取等特定工作。在Linux中提供很多数据处理命令,如果我们要以行为单位进行数据处理,可以使用sed命令。https://blog.csdn.net/Purpleendurer/article/details/141307421?spm=1001.2014.3001.5501中,我们研究了sed的基础知识。

Linux shell编程学习笔记74:sed命令——沧海横流任我行(中)-CSDN博客icon-default.png?t=N7T8https://blog.csdn.net/Purpleendurer/article/details/141369789?spm=1001.2014.3001.5501中,我们见识了sed删除和替换功能的威力。

现在我们通过一些实例来见识一下sed插入等功能的威力。

1 sed实列

1.1 插入行

1.1.1 前插

我们可以使用i命令(insert)来完成前插。 

1.1.1.1 在第3行、第4行前插入'abc'

命令为:

sed '3,4i\abc'

其中sed命令的参数说明如下:

3,4 :指定第3行、第4行

i:在前插入命令

\abc:要插入的字符串

[purpleendurer @ bash ~]  seq 7 | cat -n1  12  23  34  45  56  67  7
[purpleendurer @ bash ~]  seq 7 | cat -n | sed '3,4i\abc'1  12  2
abc3  3
abc4  45  56  67  7
[purpleendurer @ bash ~] 

1.1.1.2 在开头前插入'abc'

命令为:

sed -e '1i\abc'

其中sed命令的参数说明如下:

-e:解释脚本

1 :指定第1行

i:在前插入命令

\abc:要插入的字符串

[purpleendurer @ bash ~]  seq 7 | cat -n1  12  23  34  45  56  67  7
[purpleendurer @ bash ~]  seq 7 | cat -n | sed -e '1i\abc'
abc1  12  23  34  45  56  67  7
[purpleendurer @ bash ~] 

 

 

1.1.1.3 在所有包含1的行前插入'abc' 

命令为:

 sed  '/1*/i\abc'

[purpleendurer @ bash ~] seq 11 | cat -n 1  12  23  34  45  56  67  78  89  910  1011  11
[purpleendurer @ bash ~] seq 11 | cat -n | sed  '/1*/i\abc'
abc1  1
abc2  2
abc3  3
abc4  4
abc5  5
abc6  6
abc7  7
abc8  8
abc9  9
abc10  10
abc11  11
[purpleendurer @ bash ~] 

 

 1.1.2 追加(后插)

我们可以使用a命令(append)来完成追加(后插)。 

1.1.2.1在第3行及其后2行后追加'abc'

命令为:

sed '3,+2a\abc'

[purpleendurer @ bash ~]  seq 7 | cat -n1  12  23  34  45  56  67  7
[purpleendurer @ bash ~]  seq 7 | cat -n | sed '3,+2a\abc'1  12  23  3
abc4  4
abc5  5
abc6  67  7
[purpleendurer @ bash ~] 

 

1.1.2.2 在末尾追加'abc'

命令为:

sed '$a\abc'

[purpleendurer @ bash ~]  seq 7 | cat -n1  12  23  34  45  56  67  7
[purpleendurer @ bash ~]  seq 7 | cat -n | sed '$a\abc'1  12  23  34  45  56  67  7
abc
[purpleendurer @ bash ~] 

1.1.2.3 在偶数行后追加2行信息,第1行是abc,第2行是def

命令为:

sed  '0~2a\abc\
def
'

[purpleendurer @ bash ~] seq 5 | cat -n1  12  23  34  45  5
[purpleendurer @ bash ~] seq 5 | cat -n | sed  '0~2a\abc\
def'1  12  2
abc
def3  34  4
abc
def5  5
[purpleendurer @ bash ~] 

 

1.1.2.4 在所有包含1的行后面追加abc

命令为:

 sed '/1/aabc'

 

[purpleendurer @ bash ~] seq 10 | cat -n1  12  23  34  45  56  67  78  89  910  10
[purpleendurer @ bash ~] seq 10 | cat -n | sed '/1/aabc'1  1
abc2  23  34  45  56  67  78  89  910  10
abc
[purpleendurer @ bash ~] 

1.1.2.5 在只含有1个1的行后面追加abc 

命令为:

 sed '/1$/aabc'

[purpleendurer @ bash ~] seq 10 | cat -n1  12  23  34  45  56  67  78  89  910  10
[purpleendurer @ bash ~] seq 10 | cat -n | sed '/1$/aabc'1  1
abc2  23  34  45  56  67  78  89  910  10
[purpleendurer @ bash ~] 

 

1.2 打印行号

我们可以使用等号(=)来代表行号。

命令为:

 sed  '='

 

[purpleendurer @ bash ~] echo "aaa" >  t.txt
[purpleendurer @ bash ~] echo "bbb" >> t.txt
[purpleendurer @ bash ~] echo "ccc" >> t.txt
[purpleendurer @ bash ~] cat t.txt
aaa
bbb
ccc
[purpleendurer @ bash ~] sed '=' t.txt
1
aaa
2
bbb
3
ccc
[purpleendurer @ bash ~] 

http://www.hkea.cn/news/599494/

相关文章:

  • 一家专门做开网店的网站北京seo专员
  • 专业企业网站搭建服务头条权重查询
  • 去哪儿网站上做民宿需要材料免费的黄冈网站有哪些平台
  • 网站建设网现在推广什么app最挣钱
  • 嘉兴装修公司做网站安装百度到桌面
  • 电商网站特点外贸营销网站建站
  • 上海市住房城乡建设管理委员会网站网络营销软文范例大全800
  • 莱芜区政协网站做网络优化的公司排名
  • 太原网站建设开发公司电商运营基本知识
  • php做企业网站seo网站推广企业
  • 万网网站备案授权书免费发布推广信息的b2b
  • 乡镇可以做门户网站seo是什么意思职业
  • 建设银行网站优点做个公司网站大概多少钱
  • 网站标题的设置方法哪家建设公司网站
  • 网站空间托管电商平台的营销方式
  • 网站制作专业的公司有哪些seo网站编辑是做什么的
  • wordpress 分栏seo怎么优化简述
  • php网站开发 多少钱推广方案策划
  • 芜湖做网站公司广州seo好找工作吗
  • 做网站找客户百度竞价推广公司
  • 深圳网站建设怎么办互联网营销的优势
  • 课程网站开发背景网站推广的几种方法
  • 商城网站建设模板一份完整的营销策划方案
  • 推广网站建设网站权重查询工具
  • t型布局网站怎么做建设网官方网站
  • 哪个建设网站推广竞价托管公司
  • 网站建设傲seo网站是什么意思
  • 卢氏住房和城乡建设厅网站聚名网
  • 山东网站建设电话长沙靠谱的关键词优化
  • 山东营销型网站ip网站查询服务器