![]() |
Hello and Welcome from United States to the UNIX and Linux Forums! Thank You for Visiting and Joining Our Global Community.
|
|
google unix.com
|
|||||||
| Forums | Register | Forum Rules | Links | Albums | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
| 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 |
| Shell script to catch PL/SQL return values | Veera_Raghav | Shell Programming and Scripting | 1 | 12-19-2008 05:47 PM |
| How to launch a Csh shell script using Excel Macro ? | Raynon | Shell Programming and Scripting | 1 | 11-08-2006 12:22 PM |
| Return value (int) from main to calling shell | flounder | High Level Programming | 3 | 09-25-2006 10:14 PM |
| return variable from PL/SQL procedure to shell | ap_gore79 | Shell Programming and Scripting | 4 | 06-03-2004 04:49 PM |
| macro on shell script ? | inquirer | UNIX for Dummies Questions & Answers | 4 | 08-15-2001 10:31 PM |
![]() |
|
|
LinkBack | Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
||||
|
Return shell value to a VI macro
Hi,
Have searched around for a solution to this and get frustrating close but have not nailed it. vi on HP-UX what I'm trying to do is utilise the key mapping available within Vi to run a shell script which uses awk script to scan the file i'm working on and return the line number or unique pattern (could go either way but the principle im trying to achieve is pass a value back so that vi macro can then utilise it) The closest ive got via Google is The most powerful macros, however, are created using programs combined into shell scripts (or DOS batch files), and acting as filters on the text sent to them from within vi. Such shell scripts or programs must take standard input and send results to standard output (which most UNIX tools do). but guess what no example! I've tried more in hope than expectation to set a map command as follows: map ^[[O ^[: !line_test^M where line_test is hard coded to echo out a line number which then can but as expected all it does is echo out the line number and is not interpreted as the line number I wanted to go to. I subsequently modified the script to exit with a value and then tried to use $? map ^[[O :!line_test : ^[: $?^M but get error badly formatted address any help greatly appreciated. |
|
||||
|
found it (sort of)
Despite the absence of any reply (not sure if this question was in the wrong place or just didn't interest anybody!) i have found an answer which i will post as I know from past experience that nothing is more frustrating than trawling the Net for something find it and then found its not been followed up.
I managed to achieve my goal by having the external shell script write out the value to a file in /tmp, the macro then read in the file to the current file , deleted the line and assigned it to buffer 'a' and then using the @ notation to pass to the : (go to line) command. map ^[[O :!goto_func %^M :r /tmp/goto.mac^M "add:@a^M : !rm -f /tmp/goto.mac^M still a bit cludgy as edits the existing file, (im thinking is there a way of reading directly into the buffer?) if anyone has a more elegant solution then please post it here. |
| Sponsored Links | ||
|
|
![]() |
| Bookmarks |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|