Vim Search in Flat Files



I have been working with Flat Files recently, and I found Vim Search patterns can help with finding certain conditions within the file.  This pattern works very well:

\{n}

Searches for n number of the preceding pattern.

For example, say you want to find any lines in the file that have a “2” in the 51st position of the file.  You can use this pattern:

^.\{50}2

So, this matches 50 characters of anything and a “2” following.

Reference:

Softpanorama: Vim Regular Expressions


Share