在每行开头都添加固定字符串

tt posted @ 2008年2月29日 18:12 in 正则表达式 , 4648 阅读

在用VTK显示三角网格文件,有时其他类型的文件与其文件格式类似,

。。。

点序列          x  y  z

面序列 -- 3 id1 id2 id3

但有些文件(如gts文件)面表序列前面没有那个“3”,这需要我们手工添加,如果不想通过写个小程序来实现,正则表达式可以帮您。

把面表部分剪切到另一文件,在该文件中输入命令

:%s  /^/3\ /

搞定,

在每行的开头都多了“3 ”,

再剪切回去就ok了。

Avatar_small
silence 说:
2008年3月03日 15:09

你说的是在 vim 中的做法吧。 用 awk 来做,也很简单。

$ awk '{print 3 " " $0}'  your-file
Avatar_small
boardmodelpaper.com 说:
2024年1月24日 23:45

Board Model Papers 2024 provide all states of 6th to 10th text books 2024 Candidates who are Searching for 6th to 10th and 11th to 12th text books and syllabus, sample questions, exam pattern, and Co-Curricular Subject textbooks can refer to this entire article. boardmodelpaper.com and question papers for following the website and Arts, Science, Commerce Stream Subject Wise Solved Question Bank for Hindi & English Medium Students with Exam Pattern & Blueprint and subject Wise with 11th & 12th Question Bank 2024 for General & Vocational Course. Here, we have gathered all subjects of Board textbooks for all Class along with the direct download links.


登录 *


loading captcha image...
(输入验证码)
or Ctrl+Enter