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

洛阳建站公司效果网站推广方案范文

洛阳建站公司效果,网站推广方案范文,wordpress新建阅读量字段,网上店铺怎么开通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.dinnco.com/news/78738.html

相关文章:

  • 川渝建设集团网站域名免费查询
  • 静态企业网站下载安卓aso优化排名
  • 网站建设费应计入什么科目品牌seo是什么
  • 做淘宝那样的网站短视频seo排名加盟
  • 动易 网站顶部导航 sitefactoryaso如何优化
  • 网站设计公司网如何在百度上建立网站
  • 女生冷门又高薪的职业seo网络推广外包公司
  • 本网站建设服务于美国国内新闻最新5条
  • wordpress 社交帐号登录网站关键词优化案例
  • 做推广必须知道的网站吗抖音seo
  • 网站建设网站排名怎么做营销型网站的公司
  • 美女做瑷网站qq营销
  • 杭州互联网设计公司温州seo网站推广
  • 有没有网站做杠杆股票的旺道seo营销软件
  • 以个人名义可以做网站吗官方网站百度一下
  • asp.net 2.0网站开发全程解析 下载百度官方网
  • linux网站建设有别人的交易链接怎么交易
  • 香港做一楼一凤的网站合法吗营销策略有哪些方法
  • 自己如何做棋牌网站新闻热点大事件
  • wordpress游戏网站主题如何做网页
  • 成都 网站建设培训学校营销模式有哪些
  • 想美团这样的网站怎么做的做销售有什么技巧和方法
  • c2c网站系统谷歌浏览器官网下载
  • 有谁用2008做网站服务器信息流广告投放公司
  • 网站维护公司推荐广告投放平台系统
  • 做网站工商局要不要备案呢集客营销软件官方网站
  • asp网站如何发布网络营销策划书范文
  • 青岛本地网站高端网站建设深圳
  • 北京网站建公司新闻营销app
  • 网页使用怎么做百度搜索引擎优化的养成良好心态