Inout would be something like this#!/usr/bin/perl $file = shift; open ( FH , "$file" ) or die "$!"; #open ( NT , ">new_table" ) or die "$!"; open ( OUT , ">>out" ) or die "$!"; $old_started = 0; print OUT "New_schema | Old_schema\n"; while ( <FH> ) { chomp; $line = $_; next if ( $line =~ /^--/ or $line =~ /^$/ or $line =~ /^\s+$/); if ( $line =~ /^INSERT INTO/i ) { $line =~ /INSERT INTO (.*)\((.*),/; $new_table = $1; $column = $2; $column =~ s/,//g; push @new_columns, $column; } while ( 1 ) { chomp($line = <FH>); $line =~ s/,//g; $line =~ s/\)//g; if ( $line =~ /^SELECT/ || $old_started == 1 ) { if ( $line =~ /^FROM/ ) { $line =~ /FROM (.*);/; $old_table = $1; $old_started = 0; $index = 0; while ( $new_columns[$index] ) { print OUT "$new_table.$new_columns[$index] | $old_table.$old_c +olumns[$index]\n"; $index++; } $index = 0; #print "$new_table => @new_columns : $#new_columns\n"; #print "$old_table => @old_columns : $#old_columns\n"; last; } push @old_columns, $line if ( $line !~ /^SELECT/); $old_started = 1; next; } push @new_columns,$line; } }
From the above input the script produce the output as-- 2) 206: The specified table (xxxxx) is not in the database -- 111: ISAM error: no record found. -- Solution : You have to install the SGN3. INSERT INTO nokia_scp_address_camel_1_raw(nc_id, scp_address_id, day, sgsncamelactivepdpcontexts, sgsncamelactivesmses, sgsncamelcapdialforpdpcontexts, sgsncamelcapdialoguesforsmses, sgsncamelcapfailwithpdpcontext) SELECT nc_id, scp_address_id, day, sgsncamelactivepdpcontexts, sgsncamelactivesmses, sgsncamelcapdialforpdpcontexts, sgsncamelcapdialoguesforsmses, sgsncamelcapfailwithpdpcontext FROM nokia_scp_address_camel_raw;
Is ther any simply way will i be able to acheive the task.nokia_scp_address_camel_1_raw.nc_id + nokia_scp_address_camel_raw.nc_id nokia_scp_address_camel_1_raw.scp_address_id nokia_scp_ +address_camel_raw.scp_address_id nokia_scp_address_camel_1_raw.day nokia_scp_address +_camel_raw.day nokia_scp_address_camel_1_raw.sgsncamelactivepdpcontexts nokia_ +scp_address_camel_raw.sgsncamelactivepdpcontexts nokia_scp_address_camel_1_raw.sgsncamelactivesmses nokia_sc +p_address_camel_raw.sgsncamelactivesmses nokia_scp_address_camel_1_raw.sgsncamelcapdialforpdpcontexts no +kia_scp_address_camel_raw.sgsncamelcapdialforpdpcontexts nokia_scp_address_camel_1_raw.sgsncamelcapdialoguesforsmses nok +ia_scp_address_camel_raw.sgsncamelcapdialoguesforsmses nokia_scp_address_camel_1_raw.sgsncamelcapfailwithpdpcontext no +kia_scp_address_camel_raw.sgsncamelcapfailwithpdpcontext
In reply to need a intelligence way of parsing the file by greatshots
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |