The formatting of that last "default" line makes it harder than it should be. This solution relies on the amount of whitespace at the start of column definitions.
#!/usr/bin/perl use strict; use warnings; my $tab; while (<DATA>) { if (/create table.+\.(\w+)/) { $tab = $1; } if (/^ (\w+)/) { print "$tab.$1\n"; } } __DATA__ create table "metrica".vodafone_capacity_cell_count_week ( nc_id integer, cell_id varchar(50) not null , week_of integer not null , busy_hour "informix".utime, gsm_tch_cong_pc_range_1 integer, gsm_tch_cong_pc_range_2 integer, gsm_tch_cong_pc_range_3 integer, gsm_sdcch_cong_pc_range_1 integer, gsm_sdcch_cong_pc_range_2 integer, gsm_sdcch_cong_pc_range_3 integer, gsm_sdcch_cong_pc_range_4 integer, gsm_hr_tch_util_pc_range_1 integer, gsm_hr_tch_util_pc_range_2 integer, gsm_hr_tch_util_pc_range_3 integer, gsm_hr_tch_util_pc_range_4 integer, gsm_hr_tch_util_pc_range_5 integer, gprs_cong_pc_range_1 integer, gprs_cong_pc_range_2 integer, gprs_cong_pc_range_3 integer, config_tch integer, config_fpdch integer, config_trx integer, config_layer integer, cell_type varchar(25) default null );
"The first rule of Perl club is you do not talk about
Perl club."
-- Chip Salzenberg
In reply to Re: removing unwanted lines from the pattern match
by davorg
in thread removing unwanted lines from the pattern match
by greatshots
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |