sed中那些特殊的替换 Posted on 2015-12-26 | In Linux | Comments: | Views: ℃ | Words count in article: | Reading time ≈ 修改匹配的第N个内容1234567891011121314151617cat text1223222sed ':a;N;$! ba;s/2/--/5' text1 #替换第5个22322--sed ':a;N;$!ba;s/\(.*\)2/\1--/' text1 #替换最后一个cat text22 52 8 2sed 's/2/--/4' text22 52 8 -- Related Posts Advanced-sed:n,N,d,D,p,P,b, T,t,h,H,g,G,x,y sed:流编辑器(stream editor)简单总结 欢迎关注 Post author: tiramisutes Post link: http://tiramisutes.github.io/2015/12/26/sed-s.html Copyright Notice: All articles in this blog are licensed under BY-NC-SA unless stating additionally.