- 浏览: 267033 次
- 性别:
- 来自: 苏州
-
文章分类
最新评论
-
di1984HIT:
这个是默认的。!
ElasticSearch (3) Java API -- put mapping to index -
di1984HIT:
谢谢,学习了~~~
ElasticSearch (3) Java API -- put mapping to index -
di1984HIT:
写的很好,谢谢啦
ElasticSearch (3) Java API -- put mapping to index -
swzzm:
.............文件加密了,密码了
Hive + Hbase
语法
sed [options] '{command}' [filename]
替换命令
's/{old value}/{new value}/'
例子
$echo The tiger cubs will meet on Tuesday afer school | sed 's/tiger/wolf/'
The wolf cubs will meet on Tuesday afer school
$echo The tiger cubs will meet on Tuesday after school | sed -e 's/tiger/wolf/' -e 's/after/befor/'
The wolf cubs will meet on Tuesday befor school
$echo The tiger cubs will meet on Tuesday after scholl | sed 's/tiger/wolf/;s/after/before/'
The wolf cubs will meet on Tuesday before scholl
$echo The tiger cubs will meet on Tuesday after school | sed '
> s/tiger/wolf/
> s/after/before/
> '
The wolf cubs will meet on Tuesday before school
$echo The tiger cubs will meet this Tuesday at the same time as the meeting last Tuesday |sed 's/Tuesday/Thursday/'
The tiger cubs will meet this Thursday at the same time as the meeting last Tuesday
$echo The tiger cubs will meet this Tuesday at the same time as meeting last Tuesday | sed 's/Tuesday/Thursday/g'
The tiger cubs will meet this Thursday at the same time as meeting last Thursday
sed 可以用来将任意的可打印字符修改为任意其它
的可打印字符。如果您想将不可打印字符修改为可打印字符—例如,铃铛修改
为单词"bell"—sed 不是适于完成这项工作的工具(但tr 是)。
$cat sample_one
one 1
two 1
three 1
one 1
two 1
two 1
three 1
模式匹配
$sed '/two/ s/1/2/' sample_one
one 1
two 2
three 1
one 1
two 2
two 2
three 1
$sed '
> /two/ s/1/2/
> /three/ s/1/3/' sample_one
one 1
two 2
three 3
one 1
two 2
two 2
three 3
$sed '
> /two/ s/1/2/
> /three/ s/1/3/' sample_one > sample_two
$cat sample_two
one 1
two 2
three 3
one 1
two 2
two 2
three 3
$
使用sed脚本文件
$cat sedlist
/two/ s/1/2/
/three/ s/1/3/
$sed -f sedlist sample_one
one 1
two 2
three 3
one 1
two 2
two 2
three 3
行匹配
$sed '5,6 s/1/2/' sample_one
one 1
two 1
three 1
one 1
two 2
two 2
three 1
禁止显示 -n
$sed -n -f sedlist sample_one
$
显示选项 -p
$cat sedlist
/two/ s/1/2/p
/three/ s/1/3/p
$sed -n -f sedlist sample_one
two 2
three 3
two 2
two 2
three 3
$
$sed -n -f sedlist sample_one > sample_two
$cat sample_two
two 2
three 3
two 2
two 2
three 3
只显示第三行到第五行
$sed -n '3,5p' sample_one
three 1
one 1
two 1
$
删除行
删除匹配行
$sed '/two/ d' sample_one
one 1
three 1
one 1
three 1
删除指定行(第一到第三行)
$sed '1,3 d' sample_one
one 1
two 1
two 1
three 1
对于流编辑器,一般当它们涉及
到全局表达式时,特别是应用于删除操作时,有几点要记住:
上三角号(^) 表示一行的开始,因此,如果"two" 是该行的头三个字符,则
sed '/^two/ d' sample_one
将只删除该行。
美元符号($) 代表文件的结尾,或一行的结尾,因此,如果"two" 是该行的最
后三个字符,则
sed '/two$/ d' sample_one
将只删除该行。
sed '/^$/ d' {filename}
删除文件中的所有空白行。
以下命令将"1" 替换为"2",以及将"1" 替换为"3",并删除文件中所有尾随的空行:
$ sed '/two/ s/1/2/; /three/ s/1/3/; /^$/ d' sample_one
以下命令将删除文件中所有的行,从第一行直到第一个空行:
sed '1,/^$/ d' {filename}
添加和插入文本
可以结合使用sed 和"a" 选项将文本添加到一个文件的末尾。实现方法如
下:
$ sed '$a\
> This is where we stop\
> the test' sample_one
one 1
two 1
three 1
one 1
two 1
two 1
three 1
This is where we stop
the test
$
在该命令中,美元符号($) 表示文本将被添加到文件的末尾。反斜线(\) 是必
需的,它表示将插入一个回车符。如果它们被遗漏了,则将导致一个错误,显
示该命令是错乱的;在任何要输入回车的地方您必须使用反斜线。
要将这些行添加到第4 和第5 个位置而不是末尾,则命令变为:
$sed '3a\
> This is where we stop\
> the rest' sample_one
one 1
two 1
three 1
This is where we stop
the rest
one 1
two 1
two 1
three 1
和几乎所有的编辑器一样,您可以选择插入而不
是添加(如果您希望这样的话)。这两者的区别是添加跟在指定的行之后,而
插入从指定的行开始。当用插入来代替添加时,只需用"i" 来代替"a",如下
所示:
$sed '3i\
> this is where we stop\
> the rest' sample_one
one 1
two 1
this is where we stop
the rest
three 1
one 1
two 1
two 1
three 1
读写文件
执行替换, 并将1-3 行写到名称为sample_three 的文件中:
$sed '
> /two/ s/1/2/
> /three/ s/1/3/
> 1,3 w sample_three' sample_one
one 1
two 2
three 3
one 1
two 2
two 2
three 3
$cat sample_three
one 1
two 2
three 3
修改命令
除了替换项目之外,还可以将行从一个值修改为另一个值。要记住的是,替换
是对字符逐个进行,而修改功能与删除类似,它影响整行:
$sed '/two/ c\
> we are no longer using two' sample_one
one 1
we are no longer using two
three 1
one 1
we are no longer using two
we are no longer using two
three 1
修改命令与替换的工作方式很相似,但在范围上要更大些—将一个项目完全替
换为另一个项目,而无论字符内容或上下文。夸张一点讲,当使用替换时,只
有字符"1" 被字符"2" 替换,而当使用修改时,原来的整行将被修改。在两种
情况下,要寻找的匹配条件都仅为"two"。
修改全部但……
对于大多数sed 命令,详细说明各种功能要进行何种修改。利用感叹号,可
以在除指定位置之外的任何地方执行修改—与默认的操作完全相反。
例如,要删除包含单词"two" 的所有行,操作为:
$sed '/two/ d' sample_one
one 1
three 1
one 1
three 1
$sed '/two/ !d' sample_one
two 1
two 1
two 1
如果您有一个文件包含一系列项目,并且想对文件中的每个项目执行一个操
作,那么首先对那些项目进行一次智能扫描并考虑将要做什么是很重要的。为
了使事情变得更简单,您可以将sed 与任意迭代例程(for、while、until)结
合来实现这一目的。
比如说,假定您有一个名为"animals" 的文件,其中包含以下项目:
pig
horse
elephant
cow
dog
cat
您希望运行以下例程:
#mcd.ksh
for I in $*
do
echo Old McDonald had a $I
echo E-I, E-I-O
done
结果将为,每一行都显示在"Old McDonald has a" 的末尾。虽然对于这些项
目的大部分这是正确的,但对于"elephant" 项目,它有语法错误,因为结果应
当为"an elephant" 而不是"a elephant"。利用sed,您可以在来自shell 文
件的输出中检查这种语法错误,并通过首先创建一个命令文件来即时地更正它
们:
#sublist
/ a a/ s/ a / an /
/ a e/ s/ a / an /
/a i/ s / a / an /
/a o/ s/ a / an /
/a u/ s/ a / an /
然后执行以下过程:
$ sh mcd.ksh 'cat animals' | sed -f sublist
现在,在运行了mcd 脚本之后,sed 将在输出中搜索单个字母a (空格,
"a",空格)之后紧跟了一个元音的任意位置。如果这种位置存在,它将把该序
列修改为空格,"an",空格。这样就使问题更正后才显示在屏幕上,并确保各
处的编辑人员在晚上可以更容易地入睡。结果是:
Old McDonald had a pig
E-I, E-I-O
Old McDonald had a horse
E-I, E-I-O
Old McDonald had an elephant
E-I, E-I-O
Old McDonald had a cow
E-I, E-I-O
Old McDonald had a dog
E-I, E-I-O
Old McDonald had a cat
E-I, E-I-O
提前退出
sed 默认读取整个文件,并只在到达末尾时才停止。不过,您可以使用退出命
令提前停止处理。只能指定一条退出命令,而处理将一直持续直到满足调用退
出命令的条件。
例如,仅在文件的前五行上执行替换,然后退出:
$ sed '
> /two/ s/1/2/
> /three/ s/1/3/
> 5q' sample_one
one 1
two 2
three 3
one 1
two 2
$
在退出命令之前的项目可以是一个行号(如上所示),或者一条查找/匹配命
令:
$ sed '
> /two/ s/1/2/
> /three/ s/1/3/
> /three/q' sample_one
one 1
two 2
three 3
$
您还可以使用退出命令来查看超过一定标准数目的行,并增加比head 中的功
能更强的功能。例如,head 命令允许您指定您想要查看一个文件的前多少行
—默认数为10,但可以使用从1 到99 的任意一个数字。如果您想查看一个
文件的前110 行,您用head 不能实现这一目的,但用sed 可以:
sed 110q filename //和head进行比较
当使用sed 时,要记住的重要事项是它的工作方式。它的工作方式是:读入
一行,在该行上执行它已知要执行的所有任务,然后继续处理下一行。每一行
都受给定的每一个编辑命令的影响
如果您的操作顺序没有十分彻底地考虑清楚,那么这可能会很麻烦。例如,假
定您需要将所有的"two" 项目修改为"three",然后将所有的"three" 修改为
"four":
$ sed '
> /two/ s/two/three/
> /three/ s/three/four/' sample_one
one 1
four 1
four 1
one 1
four 1
four 1
four 1
$
最初读取的"two" 被修改为"three"。然后它满足为下一次编辑建立的准则,
从而变为"four"。最终的结果不是想要的结果—现在除了"four" 没有别的项目
了,而本来应该有"three" 和"four"。
当执行这种操作时,您必须非常用心地注意指定操作的方式,并按某种顺序来
安排它们,使得操作之间不会互相影响。例如:
$ sed '
> /three/ s/three/four/
> /two/ s/two/three/' sample_one
one 1
three 1
four 1
one 1
three 1
three 1
four 1
$
这非常有效,因为"three" 值在"two" 变成"three" 之前得到修改。
sed [options] '{command}' [filename]
替换命令
's/{old value}/{new value}/'
例子
$echo The tiger cubs will meet on Tuesday afer school | sed 's/tiger/wolf/'
The wolf cubs will meet on Tuesday afer school
$echo The tiger cubs will meet on Tuesday after school | sed -e 's/tiger/wolf/' -e 's/after/befor/'
The wolf cubs will meet on Tuesday befor school
$echo The tiger cubs will meet on Tuesday after scholl | sed 's/tiger/wolf/;s/after/before/'
The wolf cubs will meet on Tuesday before scholl
$echo The tiger cubs will meet on Tuesday after school | sed '
> s/tiger/wolf/
> s/after/before/
> '
The wolf cubs will meet on Tuesday before school
$echo The tiger cubs will meet this Tuesday at the same time as the meeting last Tuesday |sed 's/Tuesday/Thursday/'
The tiger cubs will meet this Thursday at the same time as the meeting last Tuesday
$echo The tiger cubs will meet this Tuesday at the same time as meeting last Tuesday | sed 's/Tuesday/Thursday/g'
The tiger cubs will meet this Thursday at the same time as meeting last Thursday
sed 可以用来将任意的可打印字符修改为任意其它
的可打印字符。如果您想将不可打印字符修改为可打印字符—例如,铃铛修改
为单词"bell"—sed 不是适于完成这项工作的工具(但tr 是)。
$cat sample_one
one 1
two 1
three 1
one 1
two 1
two 1
three 1
模式匹配
$sed '/two/ s/1/2/' sample_one
one 1
two 2
three 1
one 1
two 2
two 2
three 1
$sed '
> /two/ s/1/2/
> /three/ s/1/3/' sample_one
one 1
two 2
three 3
one 1
two 2
two 2
three 3
$sed '
> /two/ s/1/2/
> /three/ s/1/3/' sample_one > sample_two
$cat sample_two
one 1
two 2
three 3
one 1
two 2
two 2
three 3
$
使用sed脚本文件
$cat sedlist
/two/ s/1/2/
/three/ s/1/3/
$sed -f sedlist sample_one
one 1
two 2
three 3
one 1
two 2
two 2
three 3
行匹配
$sed '5,6 s/1/2/' sample_one
one 1
two 1
three 1
one 1
two 2
two 2
three 1
禁止显示 -n
$sed -n -f sedlist sample_one
$
显示选项 -p
$cat sedlist
/two/ s/1/2/p
/three/ s/1/3/p
$sed -n -f sedlist sample_one
two 2
three 3
two 2
two 2
three 3
$
$sed -n -f sedlist sample_one > sample_two
$cat sample_two
two 2
three 3
two 2
two 2
three 3
只显示第三行到第五行
$sed -n '3,5p' sample_one
three 1
one 1
two 1
$
删除行
删除匹配行
$sed '/two/ d' sample_one
one 1
three 1
one 1
three 1
删除指定行(第一到第三行)
$sed '1,3 d' sample_one
one 1
two 1
two 1
three 1
对于流编辑器,一般当它们涉及
到全局表达式时,特别是应用于删除操作时,有几点要记住:
上三角号(^) 表示一行的开始,因此,如果"two" 是该行的头三个字符,则
sed '/^two/ d' sample_one
将只删除该行。
美元符号($) 代表文件的结尾,或一行的结尾,因此,如果"two" 是该行的最
后三个字符,则
sed '/two$/ d' sample_one
将只删除该行。
sed '/^$/ d' {filename}
删除文件中的所有空白行。
以下命令将"1" 替换为"2",以及将"1" 替换为"3",并删除文件中所有尾随的空行:
$ sed '/two/ s/1/2/; /three/ s/1/3/; /^$/ d' sample_one
以下命令将删除文件中所有的行,从第一行直到第一个空行:
sed '1,/^$/ d' {filename}
添加和插入文本
可以结合使用sed 和"a" 选项将文本添加到一个文件的末尾。实现方法如
下:
$ sed '$a\
> This is where we stop\
> the test' sample_one
one 1
two 1
three 1
one 1
two 1
two 1
three 1
This is where we stop
the test
$
在该命令中,美元符号($) 表示文本将被添加到文件的末尾。反斜线(\) 是必
需的,它表示将插入一个回车符。如果它们被遗漏了,则将导致一个错误,显
示该命令是错乱的;在任何要输入回车的地方您必须使用反斜线。
要将这些行添加到第4 和第5 个位置而不是末尾,则命令变为:
$sed '3a\
> This is where we stop\
> the rest' sample_one
one 1
two 1
three 1
This is where we stop
the rest
one 1
two 1
two 1
three 1
和几乎所有的编辑器一样,您可以选择插入而不
是添加(如果您希望这样的话)。这两者的区别是添加跟在指定的行之后,而
插入从指定的行开始。当用插入来代替添加时,只需用"i" 来代替"a",如下
所示:
$sed '3i\
> this is where we stop\
> the rest' sample_one
one 1
two 1
this is where we stop
the rest
three 1
one 1
two 1
two 1
three 1
读写文件
执行替换, 并将1-3 行写到名称为sample_three 的文件中:
$sed '
> /two/ s/1/2/
> /three/ s/1/3/
> 1,3 w sample_three' sample_one
one 1
two 2
three 3
one 1
two 2
two 2
three 3
$cat sample_three
one 1
two 2
three 3
修改命令
除了替换项目之外,还可以将行从一个值修改为另一个值。要记住的是,替换
是对字符逐个进行,而修改功能与删除类似,它影响整行:
$sed '/two/ c\
> we are no longer using two' sample_one
one 1
we are no longer using two
three 1
one 1
we are no longer using two
we are no longer using two
three 1
修改命令与替换的工作方式很相似,但在范围上要更大些—将一个项目完全替
换为另一个项目,而无论字符内容或上下文。夸张一点讲,当使用替换时,只
有字符"1" 被字符"2" 替换,而当使用修改时,原来的整行将被修改。在两种
情况下,要寻找的匹配条件都仅为"two"。
修改全部但……
对于大多数sed 命令,详细说明各种功能要进行何种修改。利用感叹号,可
以在除指定位置之外的任何地方执行修改—与默认的操作完全相反。
例如,要删除包含单词"two" 的所有行,操作为:
$sed '/two/ d' sample_one
one 1
three 1
one 1
three 1
$sed '/two/ !d' sample_one
two 1
two 1
two 1
如果您有一个文件包含一系列项目,并且想对文件中的每个项目执行一个操
作,那么首先对那些项目进行一次智能扫描并考虑将要做什么是很重要的。为
了使事情变得更简单,您可以将sed 与任意迭代例程(for、while、until)结
合来实现这一目的。
比如说,假定您有一个名为"animals" 的文件,其中包含以下项目:
pig
horse
elephant
cow
dog
cat
您希望运行以下例程:
#mcd.ksh
for I in $*
do
echo Old McDonald had a $I
echo E-I, E-I-O
done
结果将为,每一行都显示在"Old McDonald has a" 的末尾。虽然对于这些项
目的大部分这是正确的,但对于"elephant" 项目,它有语法错误,因为结果应
当为"an elephant" 而不是"a elephant"。利用sed,您可以在来自shell 文
件的输出中检查这种语法错误,并通过首先创建一个命令文件来即时地更正它
们:
#sublist
/ a a/ s/ a / an /
/ a e/ s/ a / an /
/a i/ s / a / an /
/a o/ s/ a / an /
/a u/ s/ a / an /
然后执行以下过程:
$ sh mcd.ksh 'cat animals' | sed -f sublist
现在,在运行了mcd 脚本之后,sed 将在输出中搜索单个字母a (空格,
"a",空格)之后紧跟了一个元音的任意位置。如果这种位置存在,它将把该序
列修改为空格,"an",空格。这样就使问题更正后才显示在屏幕上,并确保各
处的编辑人员在晚上可以更容易地入睡。结果是:
Old McDonald had a pig
E-I, E-I-O
Old McDonald had a horse
E-I, E-I-O
Old McDonald had an elephant
E-I, E-I-O
Old McDonald had a cow
E-I, E-I-O
Old McDonald had a dog
E-I, E-I-O
Old McDonald had a cat
E-I, E-I-O
提前退出
sed 默认读取整个文件,并只在到达末尾时才停止。不过,您可以使用退出命
令提前停止处理。只能指定一条退出命令,而处理将一直持续直到满足调用退
出命令的条件。
例如,仅在文件的前五行上执行替换,然后退出:
$ sed '
> /two/ s/1/2/
> /three/ s/1/3/
> 5q' sample_one
one 1
two 2
three 3
one 1
two 2
$
在退出命令之前的项目可以是一个行号(如上所示),或者一条查找/匹配命
令:
$ sed '
> /two/ s/1/2/
> /three/ s/1/3/
> /three/q' sample_one
one 1
two 2
three 3
$
您还可以使用退出命令来查看超过一定标准数目的行,并增加比head 中的功
能更强的功能。例如,head 命令允许您指定您想要查看一个文件的前多少行
—默认数为10,但可以使用从1 到99 的任意一个数字。如果您想查看一个
文件的前110 行,您用head 不能实现这一目的,但用sed 可以:
sed 110q filename //和head进行比较
当使用sed 时,要记住的重要事项是它的工作方式。它的工作方式是:读入
一行,在该行上执行它已知要执行的所有任务,然后继续处理下一行。每一行
都受给定的每一个编辑命令的影响
如果您的操作顺序没有十分彻底地考虑清楚,那么这可能会很麻烦。例如,假
定您需要将所有的"two" 项目修改为"three",然后将所有的"three" 修改为
"four":
$ sed '
> /two/ s/two/three/
> /three/ s/three/four/' sample_one
one 1
four 1
four 1
one 1
four 1
four 1
four 1
$
最初读取的"two" 被修改为"three"。然后它满足为下一次编辑建立的准则,
从而变为"four"。最终的结果不是想要的结果—现在除了"four" 没有别的项目
了,而本来应该有"three" 和"four"。
当执行这种操作时,您必须非常用心地注意指定操作的方式,并按某种顺序来
安排它们,使得操作之间不会互相影响。例如:
$ sed '
> /three/ s/three/four/
> /two/ s/two/three/' sample_one
one 1
three 1
four 1
one 1
three 1
three 1
four 1
$
这非常有效,因为"three" 值在"two" 变成"three" 之前得到修改。
发表评论
-
Linux File descriptor limit
2012-11-01 13:38 31151. Find out what the current op ... -
grep 实用例子
2012-07-13 16:00 1585首先创建示例文件 $ cat demo_file THIS L ... -
sed系列:文件多行操作
2012-06-26 12:51 3463Sed reads line by line, removes ... -
sed系列:多命令执行
2012-06-22 17:01 5017Syntax: #sed -e 'command' -e 'c ... -
sed系列:行或者模式匹配删除特定行
2012-06-21 15:52 98501“p” command prints the buffer ( ... -
sed系列:用地址或者模式匹配输出文件行
2012-06-21 15:02 3578Unix Sed Introduction sed is a ... -
sed 系列: 分支操作
2012-06-21 11:47 1532无条件分支语法 $ sed ':label command(s ... -
sed 系列: 用正则表达式查找和替换
2012-06-19 20:55 33124The `s’ command is probably the ... -
sed 系列: 怎样用sed写文件
2012-06-19 20:24 2389In this article, let us review ... -
SSH password less login
2012-04-25 20:15 804http://www.thegeekstuff.com/200 ... -
Add environment variables for all users
2012-02-09 11:51 893/etc/profile example export ... -
Hadoop Cluster Setup
2012-01-13 16:11 443http://ankitasblogger.blogspot. ... -
linux下查找文件内容
2012-01-13 13:30 793#> find . -type f -exec gre ... -
FTP
2012-01-12 15:58 1011简单上传下载实例(/*.... ... -
CDH3
2012-01-05 11:46 1183CDH3 book O'Reilly's 'Hadoop ... -
Best Linux Books
2012-01-03 15:56 1394http://www.linuxlinks.com/artic ... -
Shell Command study
2012-01-03 15:25 807http://www.dedoimedo.com/comput ... -
GRUB
2012-01-03 12:22 850http://www.dedoimedo.com/comput ... -
linux 手动安装 oracle
2011-12-12 16:07 9456引用http://gohands.iteye.com/blog ... -
linux下Oracle自己启动
2011-12-12 16:03 973引用http://bbs.51cto.com/topic/th ...
相关推荐
**sed工具详解** `sed`(流编辑器Stream Editor)是一种功能强大的文本处理工具,它在Linux和Unix系统中广泛使用。通过读取输入流(一个文件或管道)中的每一行,`sed`可以对文本进行模式匹配、替换、删除、插入等...
**sedsed工具详解** `sedsed`工具是基于经典的`sed`命令行工具的扩展,它提供了更方便的功能和增强的用法。`sed`(流编辑器,Stream Editor)是一个强大的文本处理工具,常用于对输入流(标准输入)或文件进行模式...
**sed工具介绍** `sed` 是“流编辑器”(Stream Editor)的缩写,它是一种功能强大的文本处理工具,广泛应用于Linux和Unix系统中。`sed` 可以读取数据流,对输入的数据进行各种操作,如替换、删除、插入等,并将...
**sed-4.2.1-setup** 是一个安装程序,用于在计算机上部署 **sed** 工具的4.2.1版本。**sed**,全称“Stream Editor”,是Unix和类Unix操作系统中的一款强大文本处理工具。它能够对输入流(标准输入或文件)进行读取...
在Windows环境下,`cmd`命令行工具通常用于执行各种系统级操作,而`sed`(流编辑器,Stream Editor)是Unix/Linux系统中一个强大的文本处理工具,它在Windows下的应用可能需要额外的配置。本篇文章将详细介绍如何在...
标题中的"sed.exe win x32 x64"指的是在Windows操作系统中,为32位(x32)和64位(x64)系统提供的sed命令行工具。sed(流编辑器Stream Editor)是一个功能强大的文本处理工具,常用于Linux和Unix系统中,但在Windows上...
**sed和awk工具的介绍与应用** sed和awk是广泛应用于UNIX系统中的两个文本处理工具。sed是流编辑器(stream editor)的缩写,而awk则是一种编程语言,得名于其三位开发者:Alfred Aho、Peter J. Weinberger和Brian ...
SED,全称Stream EDitor,是Unix环境下的流编辑器,主要用于对文本进行过滤和转换,支持正则表达式。它以行为单位对文本进行处理,并且可以执行插入、删除、替换以及其它复杂的文本转换操作。SED可以使用单行命令...
### 通用线程sed实例详解 #### sed简介与特点 sed是一种极其强大的UNIX流编辑器,因其高效且灵活的功能在日常运维与开发工作中备受青睐。本文将深入介绍sed的基础概念及其高级用法,并通过一系列实用示例帮助读者...
### sed手册完整版知识点解析 #### 一、引言与概述 **1.1 何时使用sed** sed(Stream Editor)是一种非交互式的文本编辑工具,适用于自动化处理文本编辑任务。当你面临以下几种情况时,使用sed会非常有效: - **...
prompt$ sedsed --help usage: sedsed OPTION [-e sedscript] [-f sedscriptfile] [inputfile] OPTIONS: -f, --file add file contents to the commands to be parsed -e, --expression add the script to the ...
### SED1330/SED1335液晶控制器的应用 #### 一、SED1330概述 SED1330是一款由日本SEIKO EPSON公司研发的高性能液晶显示控制器。这款芯片以其出色的I/O缓冲能力、丰富的指令集、支持多种文本图形显示与刷新等功能,...
其中,sed是流编辑器,它是一个强大的文本处理工具,主要用来对文本进行过滤和转换。sed通过将指定的命令应用于文本流(通常是文件内容或标准输入),从而对流中的数据进行处理,并将结果输出到标准输出。 在标题...
**玩透sed:探究sed原理** `sed`(Stream Editor)是Linux/Unix环境中的一款强大的文本处理工具,它能够对输入流(标准输入、文件或管道)进行读取、处理并输出。`sed`的工作原理基于行处理,逐行读取输入,执行...
### SED中文指南:深入解析SED的用法与实例 #### 1. SED简介 SED,全称为Stream Editor,是一种强大的文本处理工具,广泛应用于UNIX系统中,用于自动化文本编辑任务。它允许用户通过一系列预定义的命令来对文本...
《SED与AWK 高清第三版》是一本专注于Linux系统中强大文本处理工具sed和awk的教程。在Linux环境中,sed和awk是不可或缺的工具,它们能够高效地处理大量文本数据,进行搜索、替换、格式化等操作,极大地提高了运维...
通过sed截取一行匹配内容 sed是一种在线编辑器,它一次处理一行内容。处理时,把当前处理的行存储在临时缓冲区中,称为“模式空间”(pattern space),接着用sed命令处理缓冲区中的内容,处理完成后,把缓冲区的...
《深入理解SED1520:51单片机与LCD显示技术的融合》 在电子工程领域,尤其是在嵌入式系统设计中,51单片机因其结构简单、易于编程而广泛应用于各种项目。而SED1520是一款常用的LCD控制器,常用于驱动字符或点阵液晶...