QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 1078|回复: 4

请教几个VI的表达式

[复制链接]
发表于 2005-11-8 22:53:38 | 显示全部楼层 |阅读模式
一直没有好好学 急用 麻烦帮帮忙

第一个   删除所有包含特定搜索结果的行
比如 /\ 1.90\ \ /  搜到 空格+1.90+空格+空格的结果后 删除此行

第二个  移动整个竖列 比如 3,4,5列是一个东西 第6列是空格
我希望 第3列是空格 原来的东西 排到4,5,6列

第三个  搜索到特定的数值 对他们进行运算  比如  如果 第二列和第三列组成的数>60 则减去 60

谢谢各位了!
 楼主| 发表于 2005-11-9 10:28:00 | 显示全部楼层
第一个知道了  是 :g/\ 1.90\ \ /d

看置顶的例子里面有列操作  这里的列指什么?
我google到的 vi 列操作其实都是行操作...
回复

使用道具 举报

发表于 2005-11-9 20:41:03 | 显示全部楼层
2nd question:
At first u must know the Separator( e.g. : ) of the columns.
then u can try:
##############################################
:1,$s/^\([^:]*:\)\([^:]*:\)\([^:]*:\)\([^:]*:\)\([^:]*:\)\( :\)/\1\2\6\3\4\5/
##############################################
I think man can resolve problems about column-manipulation with regex in vim just like sed.
回复

使用道具 举报

发表于 2005-11-9 20:58:23 | 显示全部楼层
i think normally people write a script for the third question. But of course u can try to do it with vim.
回复

使用道具 举报

发表于 2005-11-11 20:44:43 | 显示全部楼层
u shouldn't do all things in vi
u should take a look at the term "Unix and the Tools Philosophy" first
then come back
and man following commands(tools)
grep
cut
paste
and so on
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-9-30 10:29 , Processed in 0.037228 second(s), 15 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表