Sponsored Content
Top Forums Shell Programming and Scripting find and replace a line in a file Post 302594202 by gavemani on Monday 30th of January 2012 10:42:47 PM
Old 01-30-2012
find and replace a line in a file

Hi,
I am want find and replace in following content in the file.

i want to repalce a word
TABLESPACE XCRM_<ANY_CHAR>
to TABLESPACE XCRM


Sample File to Replace :
Code:
LOB(COMPLEX_VALUE) STORE AS
(
    TABLESPACE XCRM_MED_D_NEW
    STORAGE(INITIAL 64K BUFFER_POOL DEFAULT)
    ENABLE STORAGE IN ROW
    NOCACHE
    LOGGING
    CHUNK 8192
    RETENTION
)
TABLESPACE XCRM_MED_D_NEW
PCTFREE 10
PCTUSED 0
INITRANS 1
MAXTRANS 255
STORAGE(BUFFER_POOL DEFAULT)
NOPARALLEL
NOCACHE
NOROWDEPENDENCIES
PARTITION BY RANGE(VALUE_DATE)
(PARTITION MDL_PRM_20100924 VALUES LESS THAN (TO_DATE(' 2010-09-25 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    TABLESPACE XCRM_MDL_PRM_T_P20100924
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE(INITIAL 64K)
    LOGGING,
PARTITION MDL_PRM_20100925 VALUES LESS THAN (TO_DATE(' 2010-09-26 00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    TABLESPACE XCRM_MDL_PRM_T_P20100925
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255


Output :
Code:
LOB(COMPLEX_VALUE) STORE AS
(
    TABLESPACE XCRM
    STORAGE(INITIAL 64K BUFFER_POOL DEFAULT)
    ENABLE STORAGE IN ROW
    NOCACHE
    LOGGING
    CHUNK 8192
    RETENTION
)
TABLESPACE XCRM
PCTFREE 10
PCTUSED 0
INITRANS 1
MAXTRANS 255
STORAGE(BUFFER_POOL DEFAULT)
NOPARALLEL
NOCACHE
NOROWDEPENDENCIES
PARTITION BY RANGE(VALUE_DATE)
(PARTITION MDL_PRM_20100924 VALUES LESS THAN (TO_DATE(' 2010-09-25  00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    TABLESPACE XCRM
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255
    STORAGE(INITIAL 64K)
    LOGGING,
PARTITION MDL_PRM_20100925 VALUES LESS THAN (TO_DATE(' 2010-09-26  00:00:00', 'SYYYY-MM-DD HH24:MI:SS', 'NLS_CALENDAR=GREGORIAN'))
    TABLESPACE XCRM
    PCTFREE 10
    INITRANS 1
    MAXTRANS 255


Last edited by Franklin52; 01-31-2012 at 03:19 AM.. Reason: Please use code tags for code and data samples, thank you
 

10 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

find a shell and replace the line

I need a shell which makes a search of an UNIX script and them modifies. :confused: vi $(grep -l 5 $(find . -name 'vellon.bcf' -print)) (1 Reply)
Discussion started by: jvellon
1 Replies

2. Shell Programming and Scripting

Find and replace some line

Hi all I have a file which has n no. of lines. I want to find string called "John" and add 5 lines below the string. Help me to do it using script? (1 Reply)
Discussion started by: johnl
1 Replies

3. Shell Programming and Scripting

Find 5 lines and replace with 18 line in sql file where it contains multiple blocks.

My sql file xyz_abc.sql in this file there are multiple sql block in this block I need to find the following block rem Subset Rows (&&tempName.*) CREATE VIEW &&tempName.* AS SELECT * FROM &&tempName.* WHERE f is not null and replace with following code rem Subset Rows... (9 Replies)
Discussion started by: Zaheer.mic
9 Replies

4. Shell Programming and Scripting

Find in first column and replace the line with Awk, and output new file

Find in first column and replace the line with Awk, and output new file File1.txt"2011-11-02","Georgia","Atlanta","x","","" "2011-11-03","California","Los Angeles","x","","" "2011-11-04","Georgia","Atlanta","x","x","x" "2011-11-05","Georgia","Atlanta","x","x","" ... (4 Replies)
Discussion started by: charles33
4 Replies

5. Shell Programming and Scripting

Find a line using a condition and replace a string in that line

Hello, I have a 100 line code. I have given a sample of it below: ABC*654654*1*54.54*21.2*87*1*654654654654 CCC*FS*FS*SFD*DSF GGG*FGH*CGB*FBDFG*FGDG ABC*654654*1*57.84*45.4*88*2*6546546545 CCC*WSF*SG*FGH*GHJ ADA*AF*SFG*DFGH*FGH*FGTH I need to select the line starting with "ABC" its... (6 Replies)
Discussion started by: nithins007
6 Replies

6. Emergency UNIX and Linux Support

Find a line using a condition and replace a string in that line

Hello, I have a 100 line code. I have given a sample of it below: ABC*654654*1*54.54*21.2*87*1*654654654654 CCC*FS*FS*SFD*DSF GGG*FGH*CGB*FBDFG*FGDG ABC*654654*1*57.84*45.4*88*2*6546546545 CCC*WSF*SG*FGH*GHJ ADA*AF*SFG*DFGH*FGH*FGTH I need to select the line starting with "ABC" its... (3 Replies)
Discussion started by: nithins007
3 Replies

7. Shell Programming and Scripting

Find Node and replace line(s) preceding in xml file

Hello, I have an xml file whose contacts are like below: <Node>Apple <B>Value1</B> <B>Value2</B> <B>Value3</B> </Node> <Node>Mango <B>Value1</B> <B>Value2</B> <B>Value3</B> </Node> <Node>Apple <B>Value1</B> <B>Value2</B> <B>Value3</B> </Node> <Node>Bannana (3 Replies)
Discussion started by: umarsatti
3 Replies

8. UNIX for Advanced & Expert Users

Find and replace the line in text file

I have two files a.txt b.txt I want to find a line in a.txt and replace by another line from b.txt a.txt asfsdfsfsfdfsf asfwererfgdgf wrerwetretfdg b.txt werdfgdfgf werergfdgd sfdfgfgfgfgg i want to replace the 1st line of a.txt by 1st line of b.txt i want out put as (5 Replies)
Discussion started by: rammm
5 Replies

9. UNIX for Dummies Questions & Answers

Script to find line in one file and replace in another

Hey Guys, im looking for a script that will work under OSX. What i want to do is copy information from one file (Specific LIne) and write it to a certain line in another. To be more specific... I want the hostname of a mac to be gathered ( i assume its stored in a .plist file somewhere) and... (2 Replies)
Discussion started by: padgo
2 Replies

10. Shell Programming and Scripting

Find and replace last line in a file

Hi I am having a file which has like this content shown below Aaa,bb,cc,dd Xxx,yy,d,12 Dodd,12-Jun,t I need to replace last line like this Aaa,bb,cc,dd Xxx,yy,d,12 Dodd,10-August,t (13 Replies)
Discussion started by: rohit_shinez
13 Replies
ALTER 
TABLESPACE(7) SQL Commands ALTER TABLESPACE(7) NAME
ALTER TABLESPACE - change the definition of a tablespace SYNOPSIS
ALTER TABLESPACE name RENAME TO newname ALTER TABLESPACE name OWNER TO newowner DESCRIPTION
ALTER TABLESPACE changes the definition of a tablespace. You must own the tablespace to use ALTER TABLESPACE. To alter the owner, you must also be a direct or indirect member of the new owning role. (Note that superusers have these privileges automatically.) PARAMETERS
name The name of an existing tablespace. newname The new name of the tablespace. The new name cannot begin with pg_, as such names are reserved for system tablespaces. newowner The new owner of the tablespace. EXAMPLES
Rename tablespace index_space to fast_raid: ALTER TABLESPACE index_space RENAME TO fast_raid; Change the owner of tablespace index_space: ALTER TABLESPACE index_space OWNER TO mary; COMPATIBILITY
There is no ALTER TABLESPACE statement in the SQL standard. SEE ALSO
CREATE TABLESPACE [create_tablespace(7)], DROP TABLESPACE [drop_tablespace(7)] SQL - Language Statements 2010-05-14 ALTER TABLESPACE(7)
All times are GMT -4. The time now is 04:07 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy