sed

来源:互联网 发布:鹏业软件售后电话 编辑:程序博客网 时间:2024/03/29 05:41

sed教程

sed ':a;N;$!ba;s/\n/ /g'

read the whole input in a loop ,then replace '\n' with a space

逐个解释:

: label lable for b and t commands

a \text apend text

n N  read/append the next line of input into the pattern space

$ match the last line

$! not to do it on the last line

b label branch to label, if label is omitted ,branch to end of script

s/regexp/replacement  substitute command

/g globle replacement 

; combine several sed commands on one line  


原创粉丝点击