Sponsored Content
Full Discussion: sed command to overwrite
Top Forums Shell Programming and Scripting sed command to overwrite Post 302426538 by mhdmehraj on Wednesday 2nd of June 2010 07:12:00 AM
Old 06-02-2010
sed command to overwrite

Hi,

i have a file ver.sql with the following contents , Here i need to put a in the next line of END statment .
So iam doing the following

Code:
D:\>type ver.sql
begin
ctxsys.driimp.set_value('STOP_WORD','yours');
ctxsys.driimp.set_object('STORAGE','BASIC_STORAGE',2);
ctxsys.driimp.set_value('R_TABLE_CLAUSE','lob (data) store as (cache)');
ctxsys.driimp.set_value('I_INDEX_CLAUSE','compress 2');
commit;
COMMIT;  END;

D:\>sed "s@END;@ END;\n/@g" ver.sql >>ver.log

D:\>type ver.log
begin
ctxsys.driimp.set_value('STOP_WORD','yours');
ctxsys.driimp.set_object('STORAGE','BASIC_STORAGE',2);
ctxsys.driimp.set_value('R_TABLE_CLAUSE','lob (data) store as (cache)');
ctxsys.driimp.set_value('I_INDEX_CLAUSE','compress 2');
commit;
COMMIT;   END;
/

It works fine now , Here in my source file (ver.sql ) , if i already get a slash (/) after the end statment, then it need to overwrite it. But in my case it is appending in the next line ..

Code:
D:\>type ver.sql
begin
ctxsys.driimp.set_value('STOP_WORD','yours');
ctxsys.driimp.set_object('STORAGE','BASIC_STORAGE',2);
ctxsys.driimp.set_value('R_TABLE_CLAUSE','lob (data) store as (cache)');
ctxsys.driimp.set_value('I_INDEX_CLAUSE','compress 2');
commit;
COMMIT;  END;
/

D:\>sed "s@END;@ END;\n/@g" ver.sql >>ver.log

D:\>type ver.log
begin
ctxsys.driimp.set_value('STOP_WORD','yours');
ctxsys.driimp.set_object('STORAGE','BASIC_STORAGE',2);
ctxsys.driimp.set_value('R_TABLE_CLAUSE','lob (data) store as (cache)');
ctxsys.driimp.set_value('I_INDEX_CLAUSE','compress 2');
commit;
COMMIT;   END;
/
/


how to overwrite this?

---------- Post updated at 06:12 AM ---------- Previous update was at 05:40 AM ----------

Any updates please

Last edited by pludi; 06-02-2010 at 07:49 AM.. Reason: code tags, please...
 

9 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

Overwrite

if i want to pipe output to a file, say, cat abc.dat > abc.txt, how do i make it replace the existing file? (9 Replies)
Discussion started by: Duckman
9 Replies

2. UNIX for Dummies Questions & Answers

overwrite problem

Hi im using the following to copy a file to a directory, the user being prompted to overwrite if the file already exists in that directory, cp -i myfile /home/brief/bin2 but this reveals the path of the directory when being prompted to overwrite (below) cp: overwrite... (2 Replies)
Discussion started by: ali999
2 Replies

3. Shell Programming and Scripting

Loop with sed command to replace line with sed command in it

Okay, title is kind of confusion, but basically, I have a lot of scripts on a server that I need to replace a ps command, however, the new ps command I'm trying to replace the current one with pipes to sed at one point. So now I am attempting to create another script that replaces that line. ... (1 Reply)
Discussion started by: cbo0485
1 Replies

4. UNIX for Dummies Questions & Answers

overwrite problem

my script is: awk '...mycode...' file1.txt > file2.txt and i want to overwrite file2.txt eachtime I run this script. but it says:File exists! :( I have tried awk '...mycode...' file1.txt >| file2.txt but it again says:Missing name for redirect! :confused::confused: what is this? (2 Replies)
Discussion started by: gc_sw
2 Replies

5. Shell Programming and Scripting

Field overwrite using sed or awk

Is there a way to overwrite a specific field (i.e. line 2 field 3 without getting its contents). For example I would like to simply have a compatible Solaris 10 command line that replaces line 2 field 3 with contents of a variable. I would like to use SED or AWK if possible, but other suggestions... (1 Reply)
Discussion started by: thibodc
1 Replies

6. Shell Programming and Scripting

Better to Delete or Overwrite

Hello All, I had just a question about my Bash Script I'm currently writing. The script I have writes some text to a output file. After I write to the output file I send the file to another server to do some stuff with it. After the file sends in the script, I don't need the output/txt... (4 Replies)
Discussion started by: mrm5102
4 Replies

7. Shell Programming and Scripting

sed and awk giving error ./sample.sh: line 13: sed: command not found

Hi, I am running a script sample.sh in bash environment .In the script i am using sed and awk commands which when executed individually from terminal they are getting executed normally but when i give these sed and awk commands in the script it is giving the below errors :- ./sample.sh: line... (12 Replies)
Discussion started by: satishmallidi
12 Replies

8. Shell Programming and Scripting

Overwrite bash system command

Hello, The problem I met is the conflict between the default command /usr/bin/sometools, which is an very old version at system setup, and an updated one I have installed in $HOME/download-software/sometools How do I tell a third program to use the customized sometools instead of the default... (6 Replies)
Discussion started by: yifangt
6 Replies

9. SCO

Command line overwrite

is there a way to overwrite what I have typed in rather than having to hit enter and re enter the command? SCO UNIX 3.2.4.2 (14 Replies)
Discussion started by: steveo314
14 Replies
ttk::frame(n)							 Tk Themed Widget						     ttk::frame(n)

__________________________________________________________________________________________________________________________________________________

NAME
ttk::frame - Simple container widget SYNOPSIS
ttk::frame pathName ?options? _________________________________________________________________ DESCRIPTION
A ttk::frame widget is a container, used to group other widgets together. STANDARD OPTIONS
-class -cursor -takefocus -style See the ttk_widget manual entry for details on the standard options. WIDGET-SPECIFIC OPTIONS [-borderwidth borderWidth] The desired width of the widget border. Defaults to 0. [-relief relief] One of the standard Tk border styles: flat, groove, raised, ridge, solid, or sunken. Defaults to flat. [-padding padding] Additional padding to include inside the border. [-width width] If specified, the widget's requested width in pixels. [-height height] If specified, the widget's requested height in pix- els. WIDGET COMMAND
Supports the standard widget commands configure, cget, identify, instate, and state; see ttk::widget(n). NOTES
Note that if the pack, grid, or other geometry managers are used to manage the children of the frame, by the GM's requested size will nor- mally take precedence over the frame widget's -width and -height options. pack propagate and grid propagate can be used to change this. SEE ALSO
ttk::widget(n), ttk::labelframe(n), frame(n) KEYWORDS
widget, frame, container Tk 8.5 ttk::frame(n)
All times are GMT -4. The time now is 05:54 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy