Home > Software design >  unable to search for a value using vim editor in a huge file in unix
unable to search for a value using vim editor in a huge file in unix

Time:04-11

I have a sample file abc.txt and I want to search the word "-ran" in the file .

Once I open the file in vim editor and hit an escape /ran it takes me to lines where I have the word "ransome". I instead only need the word "ran"

Sample file pattern: 12,345,-ran,0.98 0 0.98 234 67 12,245,-ran,0.05 6 45 45

I have tried with vim and escape /<,-ran/> however the prompt reaches at words like ransome etc. And not the word -ran

CodePudding user response:

From vim help

\<
Matches the beginning of a word: The next char is the first char of a word. The 'iskeyword' option specifies what is a word character. /zero-width

- nor , are word characters by default, so you can update iskeyword option or search for -\<ran\> to match -ran and not -ransome

  • Related