Linux Today: Linux News On Internet Time.
Search Linux Today
Linux News Sections:  Developer -  High Performance -  Infrastructure -  IT Management -  Security -  Storage -
Linux Today Navigation
LT Home
Contribute
Contribute
Link to Us
Linux Jobs


Top White Papers

  • Corporate e-Learning technology has a long and diverse pedigree. As far back as the 1980s, companies were adopting computer-based training to supplement...
    Download

  • A global data storage provider whose business is booming needed a best-in-class data center to serve as the backbone of its technical operations going...
    Download

More on LinuxToday


Using regular expressions in Vim

Feb 28, 2009, 01:34 (0 Talkback[s])

[ Thanks to An Anonymous Reader for this link. ]

"First we need to use the "search-and-replace" command like we stated above:

":%s/exp1/exp2/g

"This is in more detail the command s (find and substitute), extended with "%" which tells it to look through the entire file. "exp1" is then replaced by "exp2", and "/g" in the end tells it to do it for all occurrences for every line.

"To boil the problem down, we first focus on what tells the line apart. We use "Play" as the command to tell the difference. We then search for "Play", and don't care about the rest, at least up until the thing we want to replace. This means we search for:"

Complete Story

Related Stories: