Sponsored Content
Full Discussion: Open vi with a command issue
Top Forums Shell Programming and Scripting Open vi with a command issue Post 302693695 by gary_w on Wednesday 29th of August 2012 02:03:10 PM
Old 08-29-2012
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:
Code:
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 vipage in the invocation options section:
Code:
 +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
 

10 More Discussions You Might Find Interesting

1. Solaris

open solaris FTP issue

Hi, I want to ftp from my virtual box to my desktop which is a windows machine. I have installed open solaris on my virtual box. though that is in network i am unable to ftp to my windows and vice versa. Please help (3 Replies)
Discussion started by: amult
3 Replies

2. UNIX for Dummies Questions & Answers

Issue: Compress in unix server and FTP to windows and open the compress file using Winzip

Hi All ! We have to compress a big data file in unix server and transfer it to windows and uncompress it using winzip in windows. I have used the utility ZIP like the below. zip -e <newfilename> df2_test_extract.dat but when I compress files greater than 4 gb using zip utility, it... (4 Replies)
Discussion started by: sakthifire
4 Replies

3. Shell Programming and Scripting

piping to 'open' command!

Hello! One command generates a file path, which I then want to open in finder. The slow way is this with C&P: $bundle show jquery-validator /Users/peter/.rvm/gems/ruby-1.9.2-p136/gems/jquery-validator-0.3.0 $open /Users/peter/.rvm/gems/ruby-1.9.2-p136/gems/jquery-validator-0.3.0 I... (4 Replies)
Discussion started by: pehrlich
4 Replies

4. Shell Programming and Scripting

Open and System command in SFTP

Hi Unix team, Is there any alternative option and command which one can use in ftp for sftp usage. open, system command --> alternative for sftp usage -n option --> alternative for sftp usage sftp supports only binary transmission. how one can achieve ascii mode file... (8 Replies)
Discussion started by: mayleeshwaran
8 Replies

5. Shell Programming and Scripting

How 2 run same command across all open terminals

Hi folks. This has been bothering me for a while. Among the 8 virtual desktops I'm using, I have 18 terminals open right now. I change some of my user configuration (e.g. put a new alias into ~/.bashrc); but in order to use this new added alias, I have to source the config file: .... (4 Replies)
Discussion started by: mirni
4 Replies

6. UNIX for Dummies Questions & Answers

File processed in Unix had issue open using notepad

Dear all, I had a columned based file after processed from my script. In unix platform, my file is ok, with all columns sorted out nicely. But when i open in windows notepad, the columns are running out of order. Can some one help?? Thanks alot in advance (4 Replies)
Discussion started by: ymeyaw
4 Replies

7. Solaris

ulimit issue with open files descriptor

We have lots of error with "Too many open files" issue. So when I increase the limit to 36656 as suggested by this forum, and when i log out from the platform, it always went back to origin value, what has went wrong ? please any suggestion ? root@hsbc_milan> ulimit -a core file size ... (1 Reply)
Discussion started by: dehetoxic
1 Replies

8. Shell Programming and Scripting

PERL - issue with OPEN

Hi, I have a menu script written in PERL which calls some shell scripts and displays the return. I'm having a problem with OPEN. A section of the code is below: `./scriptlist.ksh 1`; open OUTPUT, "</home/$SCRIPTUSER/output"; { local $/ = undef; $_ =... (2 Replies)
Discussion started by: chris01010
2 Replies

9. Shell Programming and Scripting

Variable value substitution issue with awk command issue

Hi All, I am using the below script which has awk command, but it is not returing the expected result. can some pls help me to correct the command. The below script sample.ksh should give the result if the value of last 4 digits in the variable NM matches with the variable value DAT. The... (7 Replies)
Discussion started by: G.K.K
7 Replies

10. Shell Programming and Scripting

Open command

Hi , what does this below commands do in perl ? open(fd, ">>$received_notification_file"); print fd "$feed_name,,,$feed_expected_ind,$received_ind,$copied_ind,$market_pricing_dt\n"; close(fd); also this $tmp_file_Ctrl = "$Program.tempfileC_$feed_name" ; ... (1 Reply)
Discussion started by: ptappeta
1 Replies
PTS_QUIT(1)						       AFS Command Reference						       PTS_QUIT(1)

NAME
pts_quit - Exit from pts interactive mode SYNOPSIS
pts quit [-cell] <cell name> [-noauth] [-localauth] [-force] pts q [-c] <cell name> [-n] [-l] [-f] DESCRIPTION
The pts quit command exits from pts interactive mode. The command can be run from the command line or interactively, but on the command line it does nothing and is therefore of questionable utility. CAUTIONS
Prior to OpenAFS 1.4.5 and OpenAFS 1.5.23, the pts quit command was only available on Unix or Linux and when OpenAFS was compiled with the supergroups option (disabled by default). As of OpenAFS 1.4.5 and 1.5.23, it is always available. OPTIONS
Although they have no effect, pts quit takes the following standard pts options: -cell <cell name> Names the cell in which to run the command. For more details, see pts(1). -force Enables the command to continue executing as far as possible when errors or other problems occur, rather than halting execution at the first error. -help Prints the online help for this command. All other valid options are ignored. -localauth Constructs a server ticket using a key from the local /etc/openafs/server/KeyFile file. Do not combine this flag with the -cell or -noauth options. For more details, see pts(1). -noauth Assigns the unprivileged identity anonymous to the issuer. For more details, see pts(1). OUTPUT
This command produces no output. EXAMPLES
Here is an example of a pts interactive session: % pts interactive pts> quit % SEE ALSO
pts(1), pts_interactive(1) COPYRIGHT
Copyright 2007 Jason Edgecombe <jason@rampaginggeek.com> This documentation is covered by the BSD License as written in the doc/LICENSE file. This man page was written by Jason Edgecombe for OpenAFS. OpenAFS 2014-04-08 PTS_QUIT(1)
All times are GMT -4. The time now is 01:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy