Open vi with a command issue

Solaris 5.8, ksh

I need to open everyone's favorite editor, vi of course, with a command that will place me on a search string at the time of invocation:

Given this data file:

user1   pts/1        Aug 29 13:22 (10.12.214.101)
user2   pts/2        Aug 29 09:56 (10.12.212.132)
user3   pts/3        Aug 29 12:39 (10.12.212.132)
user4   pts/6        Aug 29 13:29 (10.12.212.117)
user5   pts/5        Aug 28 08:13 (10.12.212.132)
user6   pts/4        Aug 29 13:14 (10.12.212.96)

I want to open vi , with the cursor positioned on the first occurrence of "132" (last number in the second line).

Having a look at the man vi page in the invocation options section:

 +command | -c  command
           Begin editing by executing the specified  editor  com-
           mand (usually a search or positioning command).

I launch vi like this: $ vi +/132 filename.dat , expecting to end up positioned on the "1" of the first "132". Instead, I end up at the very first column of the row that contains the pattern. So, it seems that the "specified editor command" is not necessarily the same command as you would expect after vi has opened the file (where typing /132 indeed places me on the "132".

Putting double or single quotes around the "132" does not make a difference.

Any ideas? Is there a list of what commands are available when starting vi like this? I cannot seem to find a list.

Thank you,
Gary

You can given any ex utility editing command to vi as the option argument to the -c option. Unfortunately, ex doesn't have a concept of a cursor position within a line, so you can't set the cursor to appear on the matched text unless it appears at the start of the line.

Don't know if it's any help, and perhaps you already know, after opening you will get to the position you want if you type "n" for next.

If you have vim and ksh/bash, you can use the -s option with process subsitution:

vi -s <(echo "/123") filename.dat

Edit: Oops Solaris 5.8 + ksh --- Ignore above.

Just for the fun of it, is it possible to start vi in insert mode?

---------- Post updated at 09:59 AM ---------- Previous update was at 09:47 AM ----------

Yeah I figured that out. Too bad vi +/132n filename.dat does not work. Neither does vi +/132^Mn filename.dat . n for next is an ex command. Humph.