ChinaUnix.net
相关文章推荐:

sed i

data.txt foo bar oni eeny meeny miny larry curly moe jimmy the weasel sed -n '1i\ > first line' data.txt 结果:first line -n不是不输出模式空间的内容么,为什么还有输出?难道i命令不是把内容插入到模式空间?谢谢。

by ILoveMK - Shell - 2009-01-08 20:12:21 阅读(3442) 回复(12)

相关讨论

如果没有-i参数,碰到下面的情况如何解决?(要用sed,我知道可能awk更容易) 昨天一兄弟的贴的变种:mrgreen: http://bbs2.chinaunix.net/thread-1365084-1-1.html [quote] txt文本: value1 value2 …… AAAA aaaa BBBB bbbb CCCC cccc …… xml文件: …… ...... #N行数据,这是我加的 ...

by haimming - Shell - 2009-02-09 15:20:01 阅读(6823) 回复(15)

使用sed -i会改变源文件的内容,那它还会改变模式空间的内容么?我这里的sed不认识-i选项,没法测试,谢谢拉。

by ILoveMK - Shell - 2012-01-09 12:18:59 阅读(24034) 回复(13)

ls -l 查看/etc/rc.local /etc/rc.local -> rc.d/rc.local sed -i /etc/rc.local 这个符号连接后就变样了./etc/rc.local 这个文件就变成一个文件而不是一个符号连接.这样/etc/rc.local 和 /etc/rc.d/rc.local 变成是两个文件了.并且/etc/rc.d/rc.local没有改变. 除了直接修改这个/etc/rc.d/rc.local文件 还有没有其他办法让/etc/rc.local保留原来的符号连接.而不是变成一个新的文件. 请教各位大侠.有没有碰过这个情况?

by meeslo - Shell - 2008-02-29 15:42:15 阅读(5100) 回复(9)

cat test.sh ftp cdtomb user redflag coling cd file/20031117 get expdat.dmp heh.dmp bye "| ftp -n [m85_4工作主机:]/lq/testdir>sed -n '1d;2,6{a\ > hehehehehe > p > }' test.sh user redflag coling hehehehehe cd file/20031117 hehehehehe get expdat.dmp heh.dmp hehehehehe bye hehehehehe " | ftp -n hehehehehe [m85_4工作主机:]/lq/testdir>sed -n '1d;2,6{p;a\ > hehehehehe > }' test.sh user redflag coling he...

by seamanli - Shell - 2003-12-12 12:16:02 阅读(1057) 回复(2)

[root@www themes]# ls -l ./newsportal/*.html | sed -i '/\$poll_href/d' sed:无法读取 -:没有那个文件或目录 [root@www themes]# [root@www themes]# sed -i '/\$poll/d' newsportal/vphoto.html; [root@www themes]# 想达到这个目的 [root@www themes]# ls -l ./newsportal/*.html | sed -i '/\$poll_href/d' 该怎么做呢? find能够完成,用这个就行了 find ./newsportal/ -name "*.html"| xargs sed '/$poll_h...

by flowingtree - Shell - 2007-11-12 11:21:54 阅读(2140) 回复(13)

# cat test 1 111 2 123 3 111 4 111 5 555 6 123 7 111 8 456 9 456 10 111 11 456 # sed '/111/:i;N;/123/bi' test 我的意图是,匹配111,然后定义一个标签头,直到遇见123(标签尾),跳出这整个标签,输出结果。 可命令报错。不解。 情高手帮忙看下。谢谢。

by 小木虫子 - Shell - 2009-07-28 09:18:29 阅读(2074) 回复(15)

如题想插入一个空行。。。要标准的空行,只能包含换行符。

by kvkingdom - Shell - 2009-02-16 11:12:59 阅读(1774) 回复(2)

1. awk后不用输出额外文件, 只修改输入文件. 类似sed -i 2. 匹配的不输出, 不匹配的输出. 类似grep -v 3. print { $2,$1,$3,$4,$5,$6,$7,$8} 可否有类似 print {$2,$1,$else} 或者 print {$2,$1,$0-2}简便写法

by dreamone503 - Shell - 2008-07-27 08:20:00 阅读(1739) 回复(9)

就是可以直接修改文件而不是作为标准输出

by clyet - Shell - 2007-12-16 16:41:15 阅读(2003) 回复(6)

可能程序里会有些BUG,而可能有马大哈要处理的文件只此一份,处理错了就崩了,呵呵:)

by cjaizss - Shell - 2007-12-14 13:33:45 阅读(1514) 回复(6)