Sponsored Content
Top Forums UNIX for Advanced & Expert Users unix command : how to insert text at the cursor location via command line? Post 302482858 by xib.be on Wednesday 22nd of December 2010 05:45:00 PM
Old 12-22-2010
unix command : how to insert text at the cursor location via command line?

Hi,
Well my title isn't very clear I think. So to understand my goal:
I have a script "test1"
Code:
#!/bin/bash
xvkbd -text blabla

with xbindkeys, I bind F5 key in order it runs my test1 script
So when I press F5, test1 runs.

I'm under Emacs/Vi and I press F5 in order to have "blabla" be written at the cursor location.
... but I dunno why when I use it through xbindkeys, "blabla" text isn't written when I press F5 but when I release it ... and I have to release the F5 key very fast else nothing is printed.
And what is more, in firefox it is printed at the same speed as I type... lol ... to much slow ... imagine If instead of "blabla" I have a complete sentence xD

Instead of xbindkeys , I tried gnome keybindings (in metacity) directly too ... but it was even worst concerning the timing Smilie

I didn't find a real command that would print a text at the cursor location.... instead of simulate the keyboard ... which doesn't seem to be a good idea :/

please , may someone know a such command or have a good idea ? ^^

Last edited by xib.be; 12-22-2010 at 08:54 PM..
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

unix command to insert double quotes

Hi, I am looking for a unix command which inserts double quotes around all values in a text file. For example, Input: 1234 200 4686 3506056 9646 457 5647 5066762 5656 366 5869 5978459 Output: "1234" "200" "4686" "3506056" "9646" "457" "5647" "5066762" "5656" "366" "5869"... (2 Replies)
Discussion started by: berlin_germany
2 Replies

2. UNIX for Dummies Questions & Answers

Insert line break in vi's command mode

Hi, When working in vi, the CTRL+j command for merging lines is very convenient. Is there an equivalent for splitting them (inserting a line break)? I often find myself pressing "i" + "return" + "esc", which I find a bit lengthy. Thanks in advance! (3 Replies)
Discussion started by: Skogsmulle
3 Replies

3. Shell Programming and Scripting

assign a command line argument and a unix command to awk variables

Hi , I have a piece of code ...wherein I need to assign the following ... 1) A command line argument to a variable e.g origCount=ARGV 2) A unix command to a variable e.g result=`wc -l testFile.txt` in my awk shell script When I do this : print "origCount" origCount --> I get the... (0 Replies)
Discussion started by: sweta_doshi
0 Replies

4. UNIX for Dummies Questions & Answers

unix command to insert double quotes in a delimited file

Hi, I am looking for a unix command which inserts double quotes around all values in a delimited file. For example, Input File 153665031,abc,abc ,abc 131278839,def,def ,dec 179821481,efg,efg ,lmn ... (6 Replies)
Discussion started by: Bachu
6 Replies

5. Shell Programming and Scripting

Insert shell command into first line of output file

How can I insert the command executed on the shell into the first line of my output file? For example if I execute; zcat *.gz |grep “User5501” > users.out How can I make my users.out look like; zcat *.gz |grep “User5501” > users.out User5501 PA User5501 UA User5501 ZA... (3 Replies)
Discussion started by: lewk
3 Replies

6. Shell Programming and Scripting

SED - insert space at the beginning of line and multi replace command

hi I am trying to use SED to replace the line matching a pattern using the command sed 'pattern c\ new line ' <file1 >file 2 I got two questions 1. how do I insert a blank space at the beginning of new line? 2. how do I use this command to execute multiple command using the -e... (5 Replies)
Discussion started by: piynik
5 Replies

7. Shell Programming and Scripting

Insert text line to specific location CSV

In Perl. ***edited question below*** Hey all, I am teaching myself some simple CSV file manipulation and have become a little stuck. Say I have the following layout in the CSV file: age,name,locationIs it possible to INSERT data into the CSV into the correct age order. For example, if I had... (1 Reply)
Discussion started by: whyte_rhyno
1 Replies

8. Shell Programming and Scripting

Specify an entire UNIX command as a command line argument

I'm trying to write a bash script called YN that looks like the following YN "Specify a question" "doThis" "doThat" where "doThis" will be executed if the answer is "y", otherwise "doThat". For example YN "Do you want to list the file dog?" "ls -al dog" "" Here's my attempt... (3 Replies)
Discussion started by: LeoKSimon
3 Replies

9. UNIX for Dummies Questions & Answers

sed command to Insert a line before the last four lines of the file

By using sed command, How to insert a new line before the last four lines of the file. Old Line Old Line NEW LINE! Old Line Old Line Old Line Old Line (8 Replies)
Discussion started by: wridler
8 Replies

10. Shell Programming and Scripting

Insert character at specific location in a each line of the file

Hi All, I am trying to write a shell script where it should insert character 'I' in 180th position of each line(except first and last line) of the file. Below is the script for file in /home/test/bharat/*.RET do # Process file echo "File Name=" $file #l_fileName="${file##*/}" ... (19 Replies)
Discussion started by: bharath561989
19 Replies
addch(3cur)															       addch(3cur)

Name
       addch, waddch, mvaddch, mvwaddch - add character to window

Syntax
       #include <cursesX.h>

       int addch(ch)
       chtype ch;

       int waddch(win, ch)
       WINDOW *win;
       chtype ch;

       int mvaddch(y, x, ch)
       int y, x;
       chtype ch;

       int mvwaddch(win, y, x, ch)
       WINDOW *win;
       int y, x;
       chtype ch;

Description
       The  routine inserts the character into the default window at the current cursor position and the window cursor is advanced.  The character
       is of the type which is defined in the header file, as containing both data and attributes.

       The routine inserts the character into the specified window at the current cursor position.  The cursor position is advanced.

       The routine moves the cursor to the specified (y, x) position and inserts the character into the default window.  The  cursor  position	is
       advanced after the character has been inserted.

       The  routine moves the cursor to the specified (y, x) position and inserts the character into the specified window.  The cursor position is
       advanced after the character has been inserted.

       All these routines are similar to The following information applies to all the routines.

       If the cursor moves on to the right margin, an automatic newline is performed.  If is enabled, and a character is added to the bottom right
       corner of the screen, the scrolling region will be scrolled up one line.  If scrolling is not allowed, ERR will be returned.

       If  is  a  tab,	newline,  or  backspace, the cursor will be moved appropriately within the window.  If is a newline, the routine is called
       before the cursor is moved to the beginning of the next line.  If newline mapping is off, the cursor will be moved to the  next	line,  but
       the  x  coordinate  will  be unchanged.	If is a tab the cursor is moved to the next tab position within the window.  If is another control
       character, it will be drawn in the ^X notation.	Calling the routine after adding a control character returns  the  representation  of  the
       control character, not the control character.

       Video  attributes can be combined with a character by or-ing them into the parameter.  This will result in these attributes being set.  The
       intent here is that text, including attributes, can be copied from one place to another using and For further information, see

       The and routines are macros.

Return Values
       The and functions return OK on success and ERR on error.

See Also
       clrtoeol(3cur), inch(3cur), scrollok(3cur), standout(3cur), putchar(3s)

																       addch(3cur)
All times are GMT -4. The time now is 10:43 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy