RE: [SLUG] awk, vim & input
Unfortunately we don't run X . A point I should of made is that this script works fine on a sco unix box running nawk. -Original Message- From: [EMAIL PROTECTED] [mailto:slug-admin@;slug.org.au]On Behalf Of Angus Lees Sent: Friday, 18 October 2002 8:48 AM To: Daniel Harper Cc: SLUG Subject: Re: [SLUG] awk, vim & input At 18 Oct 2002 07:20:22 +1000, James Gregory wrote: > On Thu, 2002-10-17 at 16:51, Daniel Harper wrote: > > I have an awk script the uses the system("vim " variablehere) > > function to call vim, the point being to edit a file manually and > > then get back to the awk script. > > > > Now when this runs I get a "Warning: Input is not from the > > terminal" from vim, and then it jumps straight back to the awk > > script. I am guessing that a filehandle is open or some sort or > > redirection is causing this but I am not to sure. > > I don't know much about awk, but my reading of that error message is > that vim is expecting to be started on a pty and awk's system call is > not providing it with one. yep, from a quick test here it seems to work if you run the awk script itself "from a terminal", but not if you redirect the awk stdin/stdout to non-pty things. if you had to do that, you could always cheat and system(xterm -e vim) instead (or gvim or something), assuming X. -- - Gus -- SLUG - Sydney Linux User's Group - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug -- SLUG - Sydney Linux User's Group - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug
Re: [SLUG] awk, vim & input
At 18 Oct 2002 07:20:22 +1000, James Gregory wrote: > On Thu, 2002-10-17 at 16:51, Daniel Harper wrote: > > I have an awk script the uses the system("vim " variablehere) > > function to call vim, the point being to edit a file manually and > > then get back to the awk script. > > > > Now when this runs I get a "Warning: Input is not from the > > terminal" from vim, and then it jumps straight back to the awk > > script. I am guessing that a filehandle is open or some sort or > > redirection is causing this but I am not to sure. > > I don't know much about awk, but my reading of that error message is > that vim is expecting to be started on a pty and awk's system call is > not providing it with one. yep, from a quick test here it seems to work if you run the awk script itself "from a terminal", but not if you redirect the awk stdin/stdout to non-pty things. if you had to do that, you could always cheat and system(xterm -e vim) instead (or gvim or something), assuming X. -- - Gus -- SLUG - Sydney Linux User's Group - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug
Re: [SLUG] awk, vim & input
On Thu, 2002-10-17 at 16:51, Daniel Harper wrote: > OK I am a bit stumped, and awk is certainly not my forte > > I have an awk script the uses the system("vim " variablehere) function to > call vim, the point being to edit a file manually and then get back to the > awk script. > > Now when this runs I get a "Warning: Input is not from the terminal" from > vim, and then it jumps straight back to the awk script. I am guessing that a > filehandle is open or some sort or redirection is causing this but I am not > to sure. > > Does any-one have any ideas? Is there anyway I can get some debugging > information from awk and vim to find out what is going on. I don't know much about awk, but my reading of that error message is that vim is expecting to be started on a pty and awk's system call is not providing it with one. It's kinda tricky to get around. If system doesn't provide a pty (and it doesn't seem to) there isn't really a way you can make it. Which I find more than a little surprising, although I guess it makes sense in the context of what awk is. I hate advising people to change the brand of car they drive when there's a small problem with their current one, but I don't think (from my brief reading of the man page) that awk will let you do what you want. Can some awk guru please correct me on this? I'd recommend using perl for this. Which I realise is probably not particularly helpful. If you can give us a bit more info about what you need done then we might be able to give you some perl snippets to help you on your way. Hope that isn't completely unhelpful :) James. -- SLUG - Sydney Linux User's Group - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug
Re: [SLUG] awk, vim & input
Daniel Harper wrote: > OK I am a bit stumped, and awk is certainly not my forte > > I have an awk script the uses the system("vim " variablehere) function to > call vim, the point being to edit a file manually and then get back to the > awk script. > > Now when this runs I get a "Warning: Input is not from the terminal" from > vim, and then it jumps straight back to the awk script. I am guessing that a > filehandle is open or some sort or redirection is causing this but I am not > to sure. > > Does any-one have any ideas? Is there anyway I can get some debugging > information from awk and vim to find out what is going on. I would look at replacing the call to vim with a call to sed. The latter is used for 'batch editing'. man sed for more (confusing) information. If you let the list know how you want the edit to take place, I'm sure a sed boffin will help you out further. cheers rickw -- _ Rick Welykochy || Praxis Services "I've found a security hole in the web server." "Well, either fame or an American jail await you." -- SLUG - Sydney Linux User's Group - http://slug.org.au/ More Info: http://lists.slug.org.au/listinfo/slug