Sponsored Content
Top Forums Shell Programming and Scripting Sed or Awk to remove specific lines Post 302314501 by Shoeless_Mike on Friday 8th of May 2009 01:04:00 PM
Old 05-08-2009
I should have included a better example - sorry - here is the real file:

create table "informix".esc_acct
(
fi_id decimal(9,0) not null ,
ea_nbr char(14) not null ,
rc_svcg_st_cd char(2) not null ,
ea_type_nm char(8) not null ,
ea_closd_dt date,
primary key (fi_id,ea_nbr) constraint "informix".pk_esc_acct
) extent size 12 next size 8 lock mode page ;
revoke all on "informix".esc_acct from "public" as "informix";

alter table "informix".esc_acct add constraint (foreign key (fi_id)
references "informix".fi constraint "informix".fk_esc_acct_from_fi);

When I ran Franklin's script I got:

nawk '/alter table/{f=1}/;$/{f=0;next}!f' esc_acct_resize.sql

{ TABLE "informix".esc_acct row size = 34 number of columns = 5 index size = 36 }
create table "informix".esc_acct
(
fi_id decimal(9,0) not null ,
ea_nbr char(14) not null ,
rc_svcg_st_cd char(2) not null ,
ea_type_nm char(8) not null ,
ea_closd_dt date,
primary key (fi_id,ea_nbr) constraint "informix".pk_esc_acct


So it trunc'd off too much... I am messing with the cmds that Franklin sent me.

Thanks,

Mike
 

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

how to remove specific lines from a file

When restoring a file in my uninstall program I need to remove the lines I added to a file during the install. In between the file can be modified by the users. Assume file1 is as follow: xxx str2 xxxx ..... ...The Following lines containing str* have to be removed... xxx str1 xxxx xxx ... (17 Replies)
Discussion started by: bluemoon1
17 Replies

2. Shell Programming and Scripting

How to remove lines before and after with awk / sed ?

Hi guys, I need to remove the pattern (ID=180), one line before and four lines after. Thanks. (5 Replies)
Discussion started by: ashimada
5 Replies

3. Shell Programming and Scripting

Selecting specific 'id's from lines and columns using 'SED' or 'AWK'

Hello experts, I am new to this group and to 'SED' and 'AWK'. I have data (text file) with 5 columns (C_1-5) and 100s of lines (only 10 lines are shown below as an example). I have to find or select only the id numbers (C-1) of specific lines with '90' in the same line (of C_3) AND with '20' in... (6 Replies)
Discussion started by: kamskamu
6 Replies

4. Shell Programming and Scripting

Command to remove duplicate lines with perl,sed,awk

Input: hello hello hello hello monkey donkey hello hello drink dance drink Output should be: hello hello monkey donkey drink dance (9 Replies)
Discussion started by: cola
9 Replies

5. Shell Programming and Scripting

Summing over specific lines and replacing the lines with the sum using sed, awk

Hi friends, This is sed & awk type question. I have a text file which has numbers spread all over the file. I want to sum the series of numbers whenever i find it and produce an output file with the sum. For example ###start of input text file #### abc def ghi 1 2 3 4 kjld random... (3 Replies)
Discussion started by: kaaliakahn
3 Replies

6. Shell Programming and Scripting

Using sed, awk or perl to remove substring of all lines except the first

Greetings All, I would like to find all occurences of a pattern and delete a substring from the all matching lines EXCEPT the first. For example: 1234::group:user1,user2,user3,blah1,blah2,blah3 2222::othergroup:user9,user8 4444::othergroup2:user3,blah,blah,user1 1234::group3:user5,user1 ... (11 Replies)
Discussion started by: jacksolm
11 Replies

7. Shell Programming and Scripting

ksh sed - Extract specific lines with mulitple occurance of interesting lines

Data file example I look for primary and * to isolate the interesting slot number. slot=`sed '/^primary$/,/\*/!d' filename | tail -1 | sed s'/*//' | awk '{print $1" "$2}'` Now I want to get the Touch line for only the associate slot number, in this case, because the asterisk... (2 Replies)
Discussion started by: popeye
2 Replies

8. Shell Programming and Scripting

awk to remove lines in file if specific field matches

I am trying to remove lines in the target.txt file if $5 before the - in that file matches sorted_list. I have tried grep and awk. Thank you :). grep grep -v -F -f targets.bed sort_list grep -vFf sort_list targets awk awk -F, ' > FILENAME == ARGV {to_remove=1; next} > ! ($5 in... (2 Replies)
Discussion started by: cmccabe
2 Replies

9. Shell Programming and Scripting

sed or awk to remove specific column to one range

I need to remove specific column to one range source file 3 1 000123456 2 2 000123569 3 3 000123564 12 000123156 15 000125648 128 000125648 Output required 3 000123456 2 000123569 3 000123564 12 000123156 15 000125648 128 000125648 (6 Replies)
Discussion started by: ranjancom2000
6 Replies

10. UNIX for Beginners Questions & Answers

awk with sed to combine lines and remove specific odd # pattern from line

In the awk piped to sed below I am trying to format file by removing the odd xxxx_digits and whitespace after, then move the even xxxx_digit to the line above it and add a space between them. There may be multiple lines in file but they are in the same format. The Filename_ID line is the last line... (4 Replies)
Discussion started by: cmccabe
4 Replies
DROP 
TABLE(7) PostgreSQL 9.2.7 Documentation DROP TABLE(7) NAME
DROP_TABLE - remove a table SYNOPSIS
DROP TABLE [ IF EXISTS ] name [, ...] [ CASCADE | RESTRICT ] DESCRIPTION
DROP TABLE removes tables from the database. Only the table owner, the schema owner, and superuser can drop a table. To empty a table of rows without destroying the table, use DELETE(7) or TRUNCATE(7). DROP TABLE always removes any indexes, rules, triggers, and constraints that exist for the target table. However, to drop a table that is referenced by a view or a foreign-key constraint of another table, CASCADE must be specified. (CASCADE will remove a dependent view entirely, but in the foreign-key case it will only remove the foreign-key constraint, not the other table entirely.) PARAMETERS
IF EXISTS Do not throw an error if the table does not exist. A notice is issued in this case. name The name (optionally schema-qualified) of the table to drop. CASCADE Automatically drop objects that depend on the table (such as views). RESTRICT Refuse to drop the table if any objects depend on it. This is the default. EXAMPLES
To destroy two tables, films and distributors: DROP TABLE films, distributors; COMPATIBILITY
This command conforms to the SQL standard, except that the standard only allows one table to be dropped per command, and apart from the IF EXISTS option, which is a PostgreSQL extension. SEE ALSO
ALTER TABLE (ALTER_TABLE(7)), CREATE TABLE (CREATE_TABLE(7)) PostgreSQL 9.2.7 2014-02-17 DROP TABLE(7)
All times are GMT -4. The time now is 02:33 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy