Sponsored Content
Full Discussion: sed to insert a character
Top Forums Shell Programming and Scripting sed to insert a character Post 302767395 by Chubler_XL on Wednesday 6th of February 2013 08:15:26 PM
Old 02-06-2013
Use '&' to insert matched string:

Code:
sed 's/^[0-9]/#&/'

 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

How can I insert character to end of file?

Hello all How can I insert character to the end of text file without opening it in vi Just simple one liner, can it be done? Tnx (1 Reply)
Discussion started by: umen
1 Replies

2. UNIX for Dummies Questions & Answers

Insert character in the line

Hi All, I have below type file. abc|asd|pqr|2|2|2 asc|qwe|scf|5|4|4 Pipe location and count is dynamic and coming from a variable. I want to change it to below files. (chnage the first pipe to 3 pipes) abc|||asd|pqr|2|2|2 asc|||qwe|scf|5|4|4 (chnage the second pipe to 4 pipes)... (1 Reply)
Discussion started by: swat
1 Replies

3. Shell Programming and Scripting

In Sed how can I replace starting from the 7th character to the 15th character.

Hi All, Was wondering how I can do the following.... I have a String as follows "ACCTRL000005022RRWDKKEEDKDD...." This string can be in a file called tail.out or in a Variable called $VAR2 Now I have another variable called $VAR1="000004785" (9 bytes long), I need the content of... (5 Replies)
Discussion started by: mohullah
5 Replies

4. Shell Programming and Scripting

insert character in particular position.

I want to insert space in 7th position of all the lines usign vi editor or sed command Input file 12345689010 abcdefghijk . . Output file 123456 89010 abcdef ghijk . . (7 Replies)
Discussion started by: Jairaj
7 Replies

5. Shell Programming and Scripting

Insert a character before a line

I have a file and I can get the line with a specific pattern. I want to inset # on start of the line. file.text ==== aa bb cc bb hh kk kk ll yy dd aa kk rr tt aa I want to comment out the line with contain "aa" after running the script file.text ==== #aa bb cc bb hh kk kk ll... (7 Replies)
Discussion started by: Biplab
7 Replies

6. Shell Programming and Scripting

Insert New Line Character

Hi, If my first character of a line starts with 2 then after 5th charecter newline character should be inserted. Input.txt: a1234567890 2222300007 bsdfsdf888999999 ssdfkjskfdjskfdjd 2899900000000099999999999999 28887777 999999999999999999 Output.txt: a1234567890 22223 00007... (8 Replies)
Discussion started by: unme
8 Replies

7. UNIX for Dummies Questions & Answers

Insert sign every n character (awk)

Hi, For example, I would like to insert a pipe every 4 characters for each second field (including after the last block). input (coma separated): line1,AAAABBBBCCCCDDDDEEEE line2,FFFFGGGGHHHHIIIIJJJJ output: line1,AAAA|BBBB|CCCC|DDDD|EEEE| line2,FFFF|GGGG|HHHH|IIII|JJJJ| my... (2 Replies)
Discussion started by: beca123456
2 Replies

8. Shell Programming and Scripting

sed searches a character string for a specified delimiter character, and returns a leading or traili

Hi, Anyone can help using SED searches a character string for a specified delimiter character, and returns a leading or trailing space/blank. Text file : "1"|"ExternalClassDEA519CF5"|"Art1" "2"|"ExternalClass563EA516C"|"Art3" "3"|"ExternalClass305ED16B8"|"Art9" ... ... ... (2 Replies)
Discussion started by: fspalero
2 Replies

9. UNIX for Beginners Questions & Answers

How to insert new line after a specific character in scripts?

Hi, I'm trying to add a new line after finding a specific String. That is my string: volumes: - ${DIR_WORK}/loadbalancer/html:/var/www/html and I want to change that file to: volumes: - ${DIR_WORK}/loadbalancer/html:/var/www/html extra_hosts: -... (4 Replies)
Discussion started by: siamak
4 Replies

10. UNIX for Beginners Questions & Answers

How to use sed to insert character in the beginning of file path?

I need to manipulate one Database file on Solaris 11 in which contains more than 5000 lines of data file path like this: '/data1/oradata/DBNAME/system01.dbf', '/data7/oradata/DBNAME/undotbs1_01.dbf', '/data1/oradata/DBNAME/sysaux01.dbf', '/data28/oradata/DBNAME/userdata01.dbf', ... (6 Replies)
Discussion started by: duke0001
6 Replies
curs_outopts(3CURSES)					     Curses Library Functions					     curs_outopts(3CURSES)

NAME
curs_outopts, clearok, idlok, idcok, immedok, leaveok, setscrreg, wsetscrreg, scrollok, nl, nonl - curses terminal output option control routines SYNOPSIS
cc [ flag ... ] file ... -lcurses [ library ... ] #include <curses.h> int clearok(WINDOW *win, bool bf); int idlok(WINDOW *win, bool bf); void idcok(WINDOW *win, bool bf); void immedok(WINDOW *win, bool bf); int leaveok(WINDOW *win, bool bf); int setscrreg(int top, int bot); int wsetscrreg(WINDOW *win, int top, int bot); int scrollok(WINDOW *win, bool bf); int nl(void); int nonl(void); DESCRIPTION
These routines set options that deal with output within curses. All options are initially FALSE, unless otherwise stated. It is not neces- sary to turn these options off before calling endwin(). With the clearok() routine, if enabled (bf is TRUE), the next call to wrefresh() with this window will clear the screen completely and redraw the entire screen from scratch. This is useful when the contents of the screen are uncertain, or in some cases for a more pleasing visual effect. If the win argument to clearok() is the global variable curscr(), the next call to wrefresh() with any window causes the screen to be cleared and repainted from scratch. With the idlok() routine, if enabled (bf is TRUE), curses considers using the hardware insert/delete line feature of terminals so equipped. If disabled (bf is FALSE) , curses very seldom uses this feature. (The insert/delete character feature is always considered.) This option should be enabled only if the application needs insert/delete line, for example, for a screen editor. It is disabled by default because insert/delete line tends to be visually annoying when used in applications where it isn't really needed. If insert/delete line cannot be used, curses redraws the changed portions of all lines. With the idcok() routine, if enabled (bf is TRUE), curses considers using the hardware insert/delete character feature of terminals so equipped. This is enabled by default. With the immedok() routine, if enabled (bf is TRUE), any change in the window image, such as the ones caused by waddch(), wclrtobot(), wscrl(), etc., automatically cause a call to wrefresh(). However, it may degrade the performance considerably, due to repeated calls to wrefresh(). It is disabled by default. Normally, the hardware cursor is left at the location of the window cursor being refreshed. The leaveok() option allows the cursor to be left wherever the update happens to leave it. It is useful for applications where the cursor is not used, since it reduces the need for cursor motions. If possible, the cursor is made invisible when this option is enabled. The setscrreg() and wsetscrreg() routines allow the application programmer to set a software scrolling region in a window. top and bot are the line numbers of the top and bottom margin of the scrolling region. (Line 0 is the top line of the window.) If this option and scrol- lok() are enabled, an attempt to move off the bottom margin line causes all lines in the scrolling region to scroll up one line. Only the text of the window is scrolled. (Note that this has nothing to do with the use of a physical scrolling region capability in the terminal, like that in the VT100. If idlok() is enabled and the terminal has either a scrolling region or insert/delete line capability, they will probably be used by the output routines.) The scrollok() option controls what happens when the cursor of a window is moved off the edge of the window or scrolling region, either as a result of a newline action on the bottom line, or typing the last character of the last line. If disabled, (bf is FALSE), the cursor is left on the bottom line. If enabled, (bf is TRUE), wrefresh() is called on the window, and the physical terminal and window are scrolled up one line. (Note that in order to get the physical scrolling effect on the terminal, it is also necessary to call idlok().) The nl() and nonl() routines control whether newline is translated into carriage return and linefeed on output, and whether return is translated into newline on input. Initially, the translations do occur. By disabling these translations using nonl(), curses is able to make better use of the linefeed capability, resulting in faster cursor motion. RETURN VALUES
setscrreg() and wsetscrreg() return OK upon success and ERR upon failure. All other routines that return an integer always return OK. ATTRIBUTES
See attributes(5) for descriptions of the following attributes: +-----------------------------+-----------------------------+ | ATTRIBUTE TYPE | ATTRIBUTE VALUE | +-----------------------------+-----------------------------+ |MT-Level |Unsafe | +-----------------------------+-----------------------------+ SEE ALSO
curs_addch(3CURSES), curs_clear(3CURSES), curs_initscr(3CURSES), curs_refresh(3CURSES), curs_scroll(3CURSES), curses(3CURSES), attributes(5) NOTES
The header <curses.h> automatically includes the headers <stdio.h> and <unctrl.h>. Note that clearok(), leaveok(), scrollok(), idcok(), nl(), nonl(), and setscrreg() may be macros. The immedok() routine is useful for windows that are used as terminal emulators. SunOS 5.11 31 Dec 1996 curs_outopts(3CURSES)
All times are GMT -4. The time now is 07:14 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy