How to remove unwanted elements from the command line?


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting How to remove unwanted elements from the command line?
# 1  
Old 02-21-2013
How to remove unwanted elements from the command line?

Code:
CREATE TYPE "SUPERB"."OE_L2_FOOTERDATA_REC"
  OID '1232323232' IS OBJECT
(
  AWLSTrxId          NUMBER,
  AdjPurchaseAmount NUMBER,
  Network           NUMBER,
  ConfigVersion     NUMBER
);
/

I wanted my output to be as follow:

Code:
CREATE TYPE OE_L2_FOOTERDATA_REC
  OID '1232323232' IS OBJECT
(
  AWLSTrxId          NUMBER,
  AdjPurchaseAmount NUMBER,
  Network           NUMBER,
  ConfigVersion     NUMBER
);
/

now how do i remove the double quotes and the "SUPERB" from the linux os system command line?

thanks

thanks
# 2  
Old 02-21-2013
Code:
sed 's/\"SUPERB\"\.\"\([^\"]*\)\"/\1/' file

This User Gave Thanks to balajesuri For This Post:
# 3  
Old 02-21-2013
Code:
awk -F"[ .\"]" '/SUPERB/ {print $1,$2,$7} !/SUPERB/ {print $0}' infile

# 4  
Old 02-21-2013
thanks for the reply

if the output is

Code:
CREATE or replace TYPE OE_L2_FOOTERDATA_REC   OID '1232323232' IS OBJECT (   AWLSTrxId          NUMBER,   AdjPurchaseAmount NUMBER,   Network           NUMBER,   ConfigVersion     NUMBER ); /

how do I do it? thanks
# 5  
Old 02-21-2013
Quote:
Originally Posted by jediwannabe
if the output is

Code:
CREATE or replace TYPE OE_L2_FOOTERDATA_REC   OID '1232323232' IS OBJECT (   AWLSTrxId          NUMBER,   AdjPurchaseAmount NUMBER,   Network           NUMBER,   ConfigVersion     NUMBER ); /

how do I do it?
How do you do what?
# 6  
Old 02-21-2013
how do I change from

Code:
CREATE TYPE OE_L2_FOOTERDATA_REC   OID '1232323232' IS OBJECT (   AWLSTrxId          NUMBER,   AdjPurchaseAmount NUMBER,   Network           NUMBER,   ConfigVersion     NUMBER ); /

to
Code:
CREATE or replace TYPE OE_L2_FOOTERDATA_REC   OID '1232323232' IS OBJECT (   AWLSTrxId          NUMBER,   AdjPurchaseAmount NUMBER,   Network           NUMBER,   ConfigVersion     NUMBER ); /

i.e
CREATE TYPE OE_L2_FOOTERDATA_REC


to
CREATE or replace TYPE OE_L2_FOOTERDATA_REC

what I mean add ' or replace'

thanks
# 7  
Old 02-22-2013
Code:
sed 's/^CREATE/& or replace/'

sed is an excellent tool for such jobs. Take a look at this link.
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Remove unwanted white space

Hi, I have a very big file 25GB with information present in it like $ head ind_stats update index statistics pfirm001.dbo.Office using 200 values go ... (11 Replies)
Discussion started by: sam05121988
11 Replies

2. Shell Programming and Scripting

How to remove unwanted " from string...

I have this Input File with extra double quotes in the middle. Please suggest how to handle this condition. Input File: "123985","SAW CUT CONCRETE SLAB 20"THICK",,"98.57","","EACH","N" "204312","ARMAFLEX-1 3/8 X 3"",,"2.48","","PER FOOT","N" "205745","MISTING HEAD HOLLOW CONE "C"... (3 Replies)
Discussion started by: BICC
3 Replies

3. Shell Programming and Scripting

How to remove unwanted strings?

Hi Guys, Can someone give me a hand on how I can remove unwanted strings like "<Number>" and "</Number>" and retain only the numbers from the input file below. INPUT FILE: <Number>10050000</Number> <Number>1001340001</Number> <Number>1001750002</Number> <Number>100750003</Number>... (8 Replies)
Discussion started by: pinpe
8 Replies

4. Shell Programming and Scripting

remove unwanted text using perl

Hello..I have a text file that need to remove unwanted text. This is the original file. No. Time Source Destination Protocol Info 16 0.649949 10.1.1.101 209.225.11.237 HTTP POST /scripts/cms/xcms.asp HTTP/1.1 ... (9 Replies)
Discussion started by: taxi
9 Replies

5. Shell Programming and Scripting

remove unwanted specific line range

Hello everyone...I have large txt file and I would like to remove unwanted specific line. My data is like this: So I would like to remove from line below No. until line reassambled like this: Thanks... (4 Replies)
Discussion started by: taxi
4 Replies

6. Shell Programming and Scripting

Remove unwanted lines

I have a .xml file, where i need some output. The xml file is like: Code: <?******?></ddddd><sssss>234</dfdffsdf><sdhjh>534</dfdfa>......... /Code I need the output like: code 234 534 . . . /code How can i do it? (5 Replies)
Discussion started by: anupdas
5 Replies

7. Emergency UNIX and Linux Support

Remove Unwanted Libraries - optimizing

We have a huge makefile composing of inclusion of libraries, objects and system libraries to generate a binary. How do we find out that which of the libraries we can remove in the most efficient way? Doing hit and trial method is a waste of time and can during the linking with some post linking... (12 Replies)
Discussion started by: uunniixx
12 Replies

8. Solaris

Remove unwanted packages

I got a system which was installed with SUNWCXall cluster installed on it and i want remove unwanted software like GMNOME, Java Desktop System, Staroffice and numerous other softwares .. i want to do an automated removal of these packages where its uninstalled by itself ..from the is there any... (4 Replies)
Discussion started by: fugitive
4 Replies

9. Shell Programming and Scripting

Remove unwanted XML Tags

I have set of sources and the respective resolution. Please advice how to resolve the same using Unix shell scripting. Source 1: ======= <ext:ContactInfo xmlns:ext="urn:AOL.FLOWS.Extensions"> <ext:InternetEmailAddress>AOL@AOL.COM</ext:InternetEmailAddress> </ext:ContactInfo> Resoultion... (1 Reply)
Discussion started by: ambals123
1 Replies

10. Shell Programming and Scripting

Remove unwanted data?

Hi Can any one help me remove the unwanted data? I would want to remove the complete event id 4910 ( the type there is INFO), that means, I have to remove starting from 7th - 19th lines. can any one of you please help? Thanks, (24 Replies)
Discussion started by: hitmansilentass
24 Replies
Login or Register to Ask a Question