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
CountryCode(3pm)					User Contributed Perl Documentation					  CountryCode(3pm)

NAME
NCC::CountryCode - Perl extension for blah blah blah SYNOPSIS
use NCC::CountryCode; my $cc = new NCC::CountryCode(); my $cc_hash = $cc->getCCs(); print ($cc->isCC('NL')) ? "exists" : "non-existing"; $cc->CC2Country('fr'); $cc->Country2CC('russia'); DESCRIPTION
This module provides class and several methods to simplify mapping between country names and country codes, as they assigned in the ISO3166. The CC2Country() method maps country code to the corresponding country name or empty string, if it doesn't exist. The Country2CC() tries to map passed country name into country code. As the spelling of the name may vary, this function tries to find all possible matches for passed name. In array context method returns hash of country codes and names, in scalar - a string, containing all possible country codes and corresponding country names. The isCC() method verifies, that passed country code is a legal one and returns it in upper case. Otherwise it returns empty string. The getCCs() method returns the reference to the internal hash, that containes all the country codes with corresponding them country names. BUGS
In addition to the country codes defined by ISO3166 standart this module also introduce 'UK' as a synonim for 'GB' and 'EU' as additional 'virtual' name for the Europe itself. AUTHOR
Timur Bakeyev, timur@ripe.net SEE ALSO
perl(1). perl v5.10.1 2001-09-10 CountryCode(3pm)
All times are GMT -4. The time now is 01:46 PM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy