08-25-2008
Urgent Help required : awk/sed help to find pattern and delete till end of line
Hi,
I need help with using an awk or sed filter on the below line
ALTER TABLE "ACCOUNT" ADD CONSTRAINT "ACCOUNT_PK" PRIMARY KEY ("ACCT_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "WMC_DATA" LOGGING ENABLE
Look for Pattern "USING" from above and remove from matched pattern till the end of line.
Desired Output
ALTER TABLE "ACCOUNT" ADD CONSTRAINT "ACCOUNT_PK" PRIMARY KEY ("ACCT_ID")
Quick responses appreciated
Thanks,
Rajan
10 More Discussions You Might Find Interesting
1. UNIX for Dummies Questions & Answers
I have the following line(s) of text in a file:
Card: H'00f2 Elapsed Time (day - h:m:s): 0 - 21:14:18.5
I basically want to search for "Elapsed Time", then delete this and everything else to the end of the line. I've tried a lot of different things, but cannot seem to get rid of... (1 Reply)
Discussion started by: rtstanley
1 Replies
2. Shell Programming and Scripting
I have a file with a bunch of similar lines in which I want to extract a phrase delimited by the first occurance of a '>' at the beginning and the first occurance of a '<' at the end (you might have guessed these are beginning/end of HTML tags). Using Sed I have managed to delete up to and... (7 Replies)
Discussion started by: coldcanuck
7 Replies
3. Shell Programming and Scripting
Hi,
I need help with using an awk or sed filter on the below line
ALTER TABLE "ACCOUNT" ADD CONSTRAINT "ACCOUNT_PK" PRIMARY KEY ("ACCT_ID") USING INDEX PCTFREE 10 INITRANS 2 MAXTRANS 255 STORAGE(INITIAL 65536 FREELISTS 1 FREELIST GROUPS 1) TABLESPACE "WMC_DATA" LOGGING ENABLE
Look for... (2 Replies)
Discussion started by: rajan_san
2 Replies
4. Shell Programming and Scripting
trying to use sed in finding a matching pattern in a file then deleting
the next line only .. pattern --> <ad-content>
I tried this but it results are not what I wish
sed '/<ad-content>/{N;d;}' akv.xml > akv5.xml
ex,
<Celebrant2First>Mickey</Celebrant2First>
<ad-content>
Minnie... (2 Replies)
Discussion started by: aveitas
2 Replies
5. Shell Programming and Scripting
This is my first post, please be nice. I have tried to google and read different tutorials.
The task at hand is:
Input file input.txt (example)
abc123defhij-E-1234jslo
456ujs-W-abXjklp
From this file the task is to grep the -E- and -W- strings that are unique and write a new file... (5 Replies)
Discussion started by: TestTomas
5 Replies
6. Shell Programming and Scripting
I have the following file:
line1
line2
MATCH
line3
line4
I need to find the pattern, "MATCH" and delete the line before and after MATCH. So the result should be
line1
MATCH
lline4
I have to use sed because it is the only utility that is common across my environments. I... (1 Reply)
Discussion started by: craftereric
1 Replies
7. Shell Programming and Scripting
Hi,
I need to match lines after a pattern, upto the first blank line.
Searched in web and some forums but coulnt find the answer.
where <restart_step> =
10 -- Execute query
20 -- Write the contents to the Oracle table
30 -- Writing Contents to OUTPUT... (7 Replies)
Discussion started by: justchill
7 Replies
8. Shell Programming and Scripting
Hi,
I have got the below requirement. please suggest.
I have a file like,
Processing Item is:
/data/ing/cfg2/abc.txt
/data/ing/cfg3/bgc.txt
Processing Item is:
/data/cmd/for2/ght.txt
/data/kernal/config.klgt.txt
I want to process the above file to get the output file like,
... (5 Replies)
Discussion started by: rbalaj16
5 Replies
9. Shell Programming and Scripting
I have a file which is like this
………………………………………..
…………………………………
…………………………………
……………………………………
…………………………………….
………………………………
<<<from_here>>>
………………………………
……………………………….
I want a script which would fetch the data starting from <<<from_here>>> in the file till the end... (2 Replies)
Discussion started by: halfafringe
2 Replies
10. Shell Programming and Scripting
Gents,
I am trying to delete all lines which start with "H" character, but keeping the fist header. Example In the input file I will delete all lines starting from line 8 which contents character "H" to the end of the file.
I try
sed '8,10000{/^H/d;}' file
But as don't know the end... (1 Reply)
Discussion started by: jiam912
1 Replies
LEARN ABOUT DEBIAN
sql::translator::parser::postgresql
SQL::Translator::Parser::PostgreSQL(3pm) User Contributed Perl Documentation SQL::Translator::Parser::PostgreSQL(3pm)
NAME
SQL::Translator::Parser::PostgreSQL - parser for PostgreSQL
SYNOPSIS
use SQL::Translator;
use SQL::Translator::Parser::PostgreSQL;
my $translator = SQL::Translator->new;
$translator->parser("SQL::Translator::Parser::PostgreSQL");
DESCRIPTION
The grammar was started from the MySQL parsers. Here is the description from PostgreSQL:
Table: (http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=sql-createtable.html)
CREATE [ [ LOCAL ] { TEMPORARY | TEMP } ] TABLE table_name (
{ column_name data_type [ DEFAULT default_expr ]
[ column_constraint [, ... ] ]
| table_constraint } [, ... ]
)
[ INHERITS ( parent_table [, ... ] ) ]
[ WITH OIDS | WITHOUT OIDS ]
where column_constraint is:
[ CONSTRAINT constraint_name ]
{ NOT NULL | NULL | UNIQUE | PRIMARY KEY |
CHECK (expression) |
REFERENCES reftable [ ( refcolumn ) ] [ MATCH FULL | MATCH PARTIAL ]
[ ON DELETE action ] [ ON UPDATE action ] }
[ DEFERRABLE | NOT DEFERRABLE ]
[ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
and table_constraint is:
[ CONSTRAINT constraint_name ]
{ UNIQUE ( column_name [, ... ] ) |
PRIMARY KEY ( column_name [, ... ] ) |
CHECK ( expression ) |
FOREIGN KEY ( column_name [, ... ] )
REFERENCES reftable [ ( refcolumn [, ... ] ) ]
[ MATCH FULL | MATCH PARTIAL ]
[ ON DELETE action ] [ ON UPDATE action ] }
[ DEFERRABLE | NOT DEFERRABLE ]
[ INITIALLY DEFERRED | INITIALLY IMMEDIATE ]
Index: (http://www.postgresql.org/docs/view.php?version=7.3&idoc=1&file=sql-createindex.html)
CREATE [ UNIQUE ] INDEX index_name ON table
[ USING acc_method ] ( column [ ops_name ] [, ...] )
[ WHERE predicate ]
CREATE [ UNIQUE ] INDEX index_name ON table
[ USING acc_method ] ( func_name( column [, ... ]) [ ops_name ] )
[ WHERE predicate ]
Alter table:
ALTER TABLE [ ONLY ] table [ * ]
ADD [ COLUMN ] column type [ column_constraint [ ... ] ]
ALTER TABLE [ ONLY ] table [ * ]
ALTER [ COLUMN ] column { SET DEFAULT value | DROP DEFAULT }
ALTER TABLE [ ONLY ] table [ * ]
ALTER [ COLUMN ] column SET STATISTICS integer
ALTER TABLE [ ONLY ] table [ * ]
RENAME [ COLUMN ] column TO newcolumn
ALTER TABLE table
RENAME TO new_table
ALTER TABLE table
ADD table_constraint_definition
ALTER TABLE [ ONLY ] table
DROP CONSTRAINT constraint { RESTRICT | CASCADE }
ALTER TABLE table
OWNER TO new_owner
View table:
CREATE [ OR REPLACE ] VIEW view [ ( column name list ) ] AS SELECT query
AUTHORS
Ken Y. Clark <kclark@cpan.org>, Allen Day <allenday@ucla.edu>.
SEE ALSO
perl(1), Parse::RecDescent.
perl v5.14.2 2012-05-01 SQL::Translator::Parser::PostgreSQL(3pm)