kabucek Posted April 24, 2009 Share Posted April 24, 2009 hello, I have the large file (textfile) there are word: code-007100 ... code-007199 How to substitute those all words(using vi editor), so it will change all instances to: code-007200 ... code-007299 Thanks Quote Link to comment https://forums.phpfreaks.com/topic/155523-substitute-pattern-with-another-patter-in-vi/ Share on other sites More sharing options...
premiso Posted April 24, 2009 Share Posted April 24, 2009 http://www.kingcomputerservices.com/unix_101/search_and_replace_with_vi_part_1.htm May help you out. Quote Link to comment https://forums.phpfreaks.com/topic/155523-substitute-pattern-with-another-patter-in-vi/#findComment-818393 Share on other sites More sharing options...
kabucek Posted April 24, 2009 Author Share Posted April 24, 2009 what if i got ..01 ..25 and want to change it to ..26 ..50 ? Quote Link to comment https://forums.phpfreaks.com/topic/155523-substitute-pattern-with-another-patter-in-vi/#findComment-818396 Share on other sites More sharing options...
Daniel0 Posted April 24, 2009 Share Posted April 24, 2009 Write a small script. Vi(m) can replace using regex only. Anyway, you can do e.g. :s/01/25/g, but unless you can write a pattern that catches all your matches, you cannot use it's search/replace features. Quote Link to comment https://forums.phpfreaks.com/topic/155523-substitute-pattern-with-another-patter-in-vi/#findComment-818418 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.