Sponsored Content
Top Forums Shell Programming and Scripting How to insert Parentheses to each line in a file Post 302401082 by clx on Friday 5th of March 2010 12:41:28 AM
Old 03-05-2010
or,

Code:
sed -e 's/^/(/g' -e 's/$/)/g' file

 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Insert a line as the first line into a very huge file

Hello, I need to insert a line (like a header) as the first line of a very huge file (about 3 ml rows). I am able to do it with sed, but redirecting the output and creating a new file takes quite some time. I was wondering if there was a more efficient way of doing it? Any help would be... (3 Replies)
Discussion started by: shriek
3 Replies

2. Shell Programming and Scripting

insert a line in a file

Hello guys, Need to know how to insert a line at top of the file, without using temp files. Can we do it on the fly? Regards, Rishi (7 Replies)
Discussion started by: RishiPahuja
7 Replies

3. Shell Programming and Scripting

Insert line into file

Hi, My File 'temp.txt' contents are like this. <Managers> Mng={{FIL|FAVEI.mng|111}|15.000000|17.000000|17.000000| Mng={{FIL|FAPSV.mng|222}|3.000000|0.000000|0.000000|0.000000| Mng={{FIL|FAVIF.mng|333}|8.000000|8.000000|8.000000|8.000000|... (3 Replies)
Discussion started by: vinay123
3 Replies

4. UNIX for Advanced & Expert Users

help with insert line into file

hi..i wanted to know is there any way to take input from the user and copy that a particular line number in a particular file for eg . i wanted to create acl in squid at line number 2400 in squid.conf file so the user gives an input like acl inetblock src 192.168.0.0/255.255.0.0 so is there... (4 Replies)
Discussion started by: tarunicon
4 Replies

5. Shell Programming and Scripting

best way to insert a line at the top of a file?

say I want to insert "this is a test" as the first line into file A, besides echo "this is a test" > /tmp/tmpfile cat /tmp/tmpfile fileA >> /tmp/result, is there any simple way I can do it? thanks (7 Replies)
Discussion started by: fedora
7 Replies

6. Programming

insert line into a file

how to insert a line of text that is next to the current line(file pointer pointing to) in the file ?? :wall: ex: suppose a file named 'Sample' has the following content in it. this is to give clear idea about the problem if file pointer is pointing to the first line then i want to... (3 Replies)
Discussion started by: kavitha rao
3 Replies

7. Shell Programming and Scripting

Insert a new line before every 5th line in a file

Hi, I need to insert a new line containing the string "QUERY" above every 5 lines. The below piece of code inserts a new line after every 5th line awk '{print $0} !(NR%5) {print "QUERY"}' sed 'n;n;n;n;G;' --> I do not know how to give "QUERY" string here But I need to insert it before... (4 Replies)
Discussion started by: royalibrahim
4 Replies

8. Shell Programming and Scripting

Insert a line in a file by deleting that line from another file

Hi all, I have a huge file(size more that 5GB). I want to do some manupulation with the records and write to another file. As the size of the file is huge and there is a space constraint in that directory, I want to delete that record from first file after writing it in to second file.... (3 Replies)
Discussion started by: gani_85
3 Replies

9. Shell Programming and Scripting

How to read a text file line by line and insert into a database table?

I have a test file that I want to read and insert only certain lines into the the table based on a filter. 1. Rread the log file 12 Hours back Getdate() -12 Hours 2. Extract the following information on for lines that say "DUMP is complete" A. Date B. Database Name C.... (2 Replies)
Discussion started by: JolietJake
2 Replies

10. UNIX for Beginners Questions & Answers

Insert a line of text on nth line of a file

Hi All, I am using UNix Sun OS sun4u sparc SUNW,SPARC-Enterprise My intention is to insert a line of text after 13th line of every file inside a particular directory. While trying to do it for a single file , i am using sed sed '3 i this is the 4th line' filename sed: command garbled: 3... (5 Replies)
Discussion started by: gotamp
5 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 09:16 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy