ex 單行指令: 處理文字檔案
以往需要從文字檔中進行 Search & Replace, 通常都會使用 PERL。
但其實使用 VIM 的 ex 模式便可作更快的處理。
刪除特定字串:
- echo '/delete_me/d | x!' | ex - 123.txt
Search & Replace:
- echo '%s/search/replace/g | x!' | ex - 123.txt
No Comments »
RSS feed for comments on this post. TrackBack URL
Leave a comment
You must be logged in to post a comment.