Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/perl
- use strict;
- use warnings;
- use feature qw(say);
- # Definição das variáveis
- my (@txt, $commentBlock);
- # Iniciar leitura do arquivos
- open(my $arq,'+<sql.sql') || die "$!\n";
- while (<$arq>) {
- chomp;
- $commentBlock = 1 if (substr($_, 0, 2) eq '/*');
- if ($_ ne '' && substr($_, 0, 2) ne '--' && !$commentBlock) {
- my ($monster) = $_ =~ /REPLACE INTO `mob_db` VALUES\([0-9]*,'[a-zA-z]*','(.*)','/;
- push (@txt, "$monster\n") if ($monster);
- }
- $commentBlock = 0 if (substr($_, -2) eq '*/');
- }
- close($arq);
- # Salvar TXT
- open my $fileTXT,">". 'txtGerado.txt' or die "Cannot create file TXT: $!";
- print $fileTXT @txt;
- close $fileTXT;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement