Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Trying to get into Vi (not Vim), after learning Vim.

  1. Vim has a lookabehind like /\(Not this\)\@<!$, how to do it in Vi?
  2. If I want to search recurvively down directory in Vim, I could do :vimgrep /\(Not this\)\@!$ -r *, what about Vi?
  3. if (1) and (2) are not available in Vi, how do you accomplish them?

Please, create tag lookbehind and regex.

share|improve this question
    
not sure what lookbabehind is... so I'm not gonna create that tag. created regex as a tag synonym though. –  xenoterracide Dec 18 '10 at 13:17
    
xenoterracide: 'not\@<!yes' is the lookbehind, matches "yes", "yesyes" but no match with "notyes" –  user2362 Dec 18 '10 at 13:26
add comment

2 Answers

Hum... I usually end up installing the complete version of vim in $HOME, even on unix stations like Solaris stations, that only have the old vi at first.

Otherwise, grep+egrep+$(), or even perl as Edd suggested, will do the trick from the shell.

share|improve this answer
add comment

According to vim help (:help pattern-overview), \@i is not supported by vi.

It may be you can enumerate all the possible combinations to avoid this, or find a different expression. Alternatively I guess you could farm the job off to some external tool or interpreter like perl. I checked egrep -- it doesn't support it. What are you searching for?

Out of interest, why are you preferring vi over vim?

share|improve this answer
    
read, read and read [1]. Personally, Vim is powerful but it is becoming bloated with a huge amount of properties, verbose license and edited manuals that are very hard to understand (without seeing the originals). It is easier to understand Vim and its development going some development cycles backwards. I am still total newbie but I feel mastering Vi may help to understand Vim. Step by step. [1] stackoverflow.com/questions/1218390/… –  user2362 Mar 16 '11 at 1:29
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.