nc10@your-5554c55be4 ~
$ cat sheet
server 127.0.0.1 localhost connected yes 12-3-08
server 127.0.0.1 localhost connected no 12-3-08
server 127.0.0.1 localhost connected yes 14-9-09
server 127.0.0.1 localhost connected yes 15-9-09
server 127.0.0.1 localhost connected no 16-9-09
nc10@your-5554c55be4 ~
$ sed '/^server.*$/s//&test/g' sheet
server 127.0.0.1 localhost connected yes 12-3-08 test
server 127.0.0.1 localhost connected no 12-3-08 test
server 127.0.0.1 localhost connected yes 14-9-09 test
server 127.0.0.1 localhost connected yes 15-9-09 test
server 127.0.0.1 localhost connected no 16-9-09 test
nc10@your-5554c55be4 ~
$
希望没理解错你的意思,呵呵
如果文件这样也可的,因为 /^server/ 限定了 只是行头是
user@minix-nb:~$ cat sheet
remote 127.0.0.1 localhost connected yes 12-3-08
server 127.0.0.1 localhost connected no 12-3-08
remote 127.0.0.1 localhost connected yes 14-9-09
server 127.0.0.1 localhost connected yes 15-9-09
remote 127.0.0.1 localhost connected no 16-9-09
user@minix-nb:~$ sed '/^server.*$/s//&test/g' sheet
remote 127.0.0.1 localhost connected yes 12-3-08
server 127.0.0.1 localhost connected no 12-3-08 test
remote 127.0.0.1 localhost connected yes 14-9-09
server 127.0.0.1 localhost connected yes 15-9-09 test
remote 127.0.0.1 localhost connected no 16-9-09
user@minix-nb:~$
现在假设如是nc10@your-5554c55be4 ~
$ cat sheet
server 127.0.0.1 localhost connected yes 12-3-08
server 127.0.0.1 localhost connected no 12-3-08
server 127.0.0.1 localhost connected yes 14-9-09
server 127.0.0.1 localhost connected yes 15-9-09
server 127.0.0.1 localhost connected no 16-9-09
nc10@your-5554c55be4 ~
$ sed '/^server.*$/s//&test/g' sheet
server 127.0.0.1 localhost connected yes 12-3-08 test
server 127.0.0.1 localhost connected no 12-3-08 test
server 127.0.0.1 localhost connected yes 14-9-09 test
server 127.0.0.1 localhost connected yes 15-9-09 test
server 127.0.0.1 localhost connected no 16-9-09 test
nc10@your-5554c55be4 ~
$
希望没理解错你的意思,呵呵
如果文件这样也可的,因为 /^server/ 限定了 只是行头是
server 才在行尾插入字符
user@minix-nb:~$ cat sheet
remote 127.0.0.1 localhost connected yes 12-3-08
server 127.0.0.1 localhost connected no 12-3-08
remote 127.0.0.1 localhost connected yes 14-9-09
server 127.0.0.1 localhost connected yes 15-9-09
remote 127.0.0.1 localhost connected no 16-9-09
user@minix-nb:~$ sed '/^server.*$/s//&test/g' sheet
remote 127.0.0.1 localhost connected yes 12-3-08
server 127.0.0.1 localhost connected no 12-3-08 test
remote 127.0.0.1 localhost connected yes 14-9-09
server 127.0.0.1 localhost connected yes 15-9-09 test
remote 127.0.0.1 localhost connected no 16-9-09
user@minix-nb:~$
在vim中,按下下面哪个键可以在光标所在行的行末添加字符?()
A.a
B.A
C.i
D.I
E.o
F.O
G.r
H、R
正确答案:A
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)