The UNIX and Linux Forums  

Go Back   The UNIX and Linux Forums > Top Forums > UNIX for Dummies Questions & Answers
Google UNIX.COM


UNIX for Dummies Questions & Answers If you're not sure where to post a UNIX or Linux question, post it here. All UNIX and Linux newbies welcome !!

More UNIX and Linux Forum Topics You Might Find Helpful
Thread Thread Starter Forum Replies Last Post
E:348 no string under cursor error comes in vi editor in cygwin mrityunjay22 Shell Programming and Scripting 0 12-25-2007 05:52 AM
positioning cursor enuenu High Level Programming 2 06-02-2007 12:35 AM
Help with Data Positioning from Columns in a flat file. oott1 Shell Programming and Scripting 3 06-14-2006 10:22 AM
Cursor Positioning bestbuyernc UNIX for Dummies Questions & Answers 1 09-06-2005 05:50 AM
Positioning curser at EOF in vi JimJim UNIX for Dummies Questions & Answers 6 12-08-2004 01:20 PM

Reply
 
Submit Tools LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 08-10-2004
Registered User
 

Join Date: Sep 2003
Location: Pennsylvania, USA
Posts: 25
Stumble this Post!
Cursor positioning thru VI Editor

Is there a way that I can position cursor at say line 23, column 2?

Thank you in advance.
Reply With Quote
Forum Sponsor
  #2 (permalink)  
Old 08-10-2004
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Stumble this Post!
Code:
<ESC>:23<ENTER>2|
Cheers
ZB
Reply With Quote
  #3 (permalink)  
Old 08-10-2004
Registered User
 

Join Date: Sep 2003
Location: Pennsylvania, USA
Posts: 25
Stumble this Post!
I inserted the code just as you told me to, and when I run the script (horolog), this is what I get:

A file or directory in the path name does not exist.
./horolog[7]: ESC: 0403-016 Cannot find or open the file. Am I doing something wrong?

Thank you.
Reply With Quote
  #4 (permalink)  
Old 08-10-2004
zazzybob's Avatar
Registered Geek
 

Join Date: Dec 2003
Location: Melbourne, Australia
Posts: 2,100
Stumble this Post!
I think we are communicating at cross-purposes here.

What I gave you is not code. They are keystrokes to be entered during an interactive editing session using vi.

Are you trying to script a file edit?? vi is an interactive editor - you can script edits with "ed", however.

Or are you trying to open vi at a specific place in a file? If so you can try "vi +23 filename" to open the file at the 23rd line, but to my knowledge you cannot tell vi to open at a particular column.

With vim you can specify a "-s" option with a script. E.g.
vim -s script_file filename

I did, however, find the script option very unpredictable, for example, to move to the 2nd char of the 23rd line, I needed the command string "23G|k|l" inside a script. The extra "up" keystroke (k) doesn't make sense, but was needed to get it working properly.
Reply With Quote
  #5 (permalink)  
Old 08-10-2004
Registered User
 

Join Date: Jan 2004
Location: chennai, india
Posts: 47
Stumble this Post!
If you want to place the cursor while execution of a shell script, use "tput cup 23 2 " in the script while executing the script you will see that the cursor is in 23 /2.

ex: tput cup 23 2; echo "Enter Your Name..."

just try this otherwise if you want to go to 23 line and second character while scripting the shell in vi, the previous solution is right.



raguram R
__________________
raguram r
Reply With Quote
  #6 (permalink)  
Old 08-10-2004
Registered User
 

Join Date: Sep 2003
Location: Pennsylvania, USA
Posts: 25
Stumble this Post!
I was running a script written thru the vi editor. I tried the suggestion made by Raguram, and it worked. Thank you soooooooo much.

Latha
Reply With Quote
  #7 (permalink)  
Old 08-11-2004
Registered User
 

Join Date: Jan 2004
Location: chennai, india
Posts: 47
Stumble this Post!
try all the options of tput. Its a nice command to play with cursor positioning.

raguram R
__________________
raguram r
Reply With Quote
Google The UNIX and Linux Forums
Reply

Thread Tools
Display Modes




All times are GMT -7. The time now is 09:24 PM.


Powered by: vBulletin, Copyright ©2000 - 2006, Jelsoft Enterprises Limited.
The UNIX and Linux Forums Content Copyright ©1993-2008 The CEP Blog All Rights Reserved -Ad Management by RedTyger Visit The Global Fact Book

Content Relevant URLs by vBSEO 3.2.0