![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
sed&awk
文章平均质量分 74
bluesandmetal
这个作者很懒,什么都没留下…
展开
-
sed 实现cat -n
#!/usr/bin/sed -nf # Prime the pump on the first line pattern space中读入一行 x 首先是交换指令,将hold space和pattern space的内容互换 /^$/ s/^.*$/1/ 判断pattern space是否为空,如果刚开始运行则前面hold原创 2013-01-28 10:34:39 · 487 阅读 · 0 评论 -
元字符
下表是元字符及其在正则表达式上下文中的行为的一个完整列表: 字符 描述 \ 将下一个字符标记为一个特殊字符、或一个原义字符、或一个 向后引用、或一个八进制转义符。例如,'n' 匹配字符 "n"。'\n' 匹配一个换行符。序列 '\\' 匹配 "\" 而 "\(" 则匹配 "("。 ^原创 2013-01-28 10:35:41 · 412 阅读 · 0 评论 -
sed center line
#!/usr/bin/sed -f # Put 80 spaces in the buffer 1 { x s/^$/ / s/^.*$/&&&&&&&&/ x } 1为地址,如果是第一行,则在hold space中保存80个空格 # del原创 2013-01-28 10:33:17 · 314 阅读 · 0 评论